1
0
mirror of https://github.com/netbox-community/netbox.git synced 2024-05-10 07:54:54 +00:00

Rename Tag.comments to description

This commit is contained in:
Jeremy Stretch
2020-03-13 17:00:00 -04:00
parent 1a8554fd32
commit d4f6909859
8 changed files with 40 additions and 25 deletions

View File

@ -32,6 +32,7 @@ If further customization of remote authentication is desired (for instance, if y
* dcim.Rack: The `/api/dcim/racks/<pk>/units/` endpoint has been replaced with `/api/dcim/racks/<pk>/elevation/`. * dcim.Rack: The `/api/dcim/racks/<pk>/units/` endpoint has been replaced with `/api/dcim/racks/<pk>/elevation/`.
* dcim.RackGroup: Added a `description` field * dcim.RackGroup: Added a `description` field
* dcim.Region: Added a `description` field * dcim.Region: Added a `description` field
* extras.Tag: Renamed `comments` to `description`; truncated length to 200 characters; removed Markdown rendering
* ipam.RIR: Added a `description` field * ipam.RIR: Added a `description` field
* ipam.VLANGroup: Added a `description` field * ipam.VLANGroup: Added a `description` field
* tenancy.TenantGroup: Added a `description` field * tenancy.TenantGroup: Added a `description` field

View File

@ -91,7 +91,7 @@ class TagSerializer(ValidatedModelSerializer):
class Meta: class Meta:
model = Tag model = Tag
fields = ['id', 'name', 'slug', 'color', 'comments', 'tagged_items'] fields = ['id', 'name', 'slug', 'color', 'description', 'tagged_items']
# #

View File

@ -144,12 +144,11 @@ class CustomFieldFilterForm(forms.Form):
class TagForm(BootstrapMixin, forms.ModelForm): class TagForm(BootstrapMixin, forms.ModelForm):
slug = SlugField() slug = SlugField()
comments = CommentField()
class Meta: class Meta:
model = Tag model = Tag
fields = [ fields = [
'name', 'slug', 'color', 'comments' 'name', 'slug', 'color', 'description'
] ]
@ -181,9 +180,13 @@ class TagBulkEditForm(BootstrapMixin, BulkEditForm):
required=False, required=False,
widget=ColorSelect() widget=ColorSelect()
) )
description = forms.CharField(
max_length=200,
required=False
)
class Meta: class Meta:
nullable_fields = [] nullable_fields = ['description']
# #

View File

@ -0,0 +1,23 @@
# Generated by Django 3.0.3 on 2020-03-13 20:46
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('extras', '0039_standardize_description'),
]
operations = [
migrations.AlterField(
model_name='tag',
name='comments',
field=models.CharField(blank=True, max_length=200),
),
migrations.RenameField(
model_name='tag',
old_name='comments',
new_name='description',
),
]

View File

@ -1051,9 +1051,9 @@ class Tag(TagBase, ChangeLoggedModel):
color = ColorField( color = ColorField(
default='9e9e9e' default='9e9e9e'
) )
comments = models.TextField( description = models.CharField(
max_length=200,
blank=True, blank=True,
default=''
) )
def get_absolute_url(self): def get_absolute_url(self):

View File

@ -77,7 +77,7 @@ class TagTable(BaseTable):
class Meta(BaseTable.Meta): class Meta(BaseTable.Meta):
model = Tag model = Tag
fields = ('pk', 'name', 'items', 'slug', 'color', 'actions') fields = ('pk', 'name', 'items', 'slug', 'color', 'description', 'actions')
class TaggedItemTable(BaseTable): class TaggedItemTable(BaseTable):

View File

@ -82,20 +82,13 @@
<span class="label color-block" style="background-color: #{{ tag.color }}">&nbsp;</span> <span class="label color-block" style="background-color: #{{ tag.color }}">&nbsp;</span>
</td> </td>
</tr> </tr>
<tr>
<td>Description</td>
<td>
{{ tag.description }}
</td>
</table> </table>
</div> </div>
<div class="panel panel-default">
<div class="panel-heading">
<strong>Comments</strong>
</div>
<div class="panel-body rendered-markdown">
{% if tag.comments %}
{{ tag.comments|render_markdown }}
{% else %}
<span class="text-muted">None</span>
{% endif %}
</div>
</div>
</div> </div>
<div class="col-md-6"> <div class="col-md-6">
{% include 'panel_table.html' with table=items_table heading='Tagged Objects' %} {% include 'panel_table.html' with table=items_table heading='Tagged Objects' %}

View File

@ -8,12 +8,7 @@
{% render_field form.name %} {% render_field form.name %}
{% render_field form.slug %} {% render_field form.slug %}
{% render_field form.color %} {% render_field form.color %}
</div> {% render_field form.description %}
</div>
<div class="panel panel-default">
<div class="panel-heading"><strong>Comments</strong></div>
<div class="panel-body">
{% render_field form.comments %}
</div> </div>
</div> </div>
{% endblock %} {% endblock %}