Add description field to Role model (#3655)

This commit is contained in:
Jeremy Stretch 2019-12-10 12:59:10 -05:00
parent 1f288175e4
commit 7845d9b25f
5 changed files with 32 additions and 5 deletions

View File

@ -71,7 +71,7 @@ class RoleSerializer(ValidatedModelSerializer):
class Meta:
model = Role
fields = ['id', 'name', 'slug', 'weight', 'prefix_count', 'vlan_count']
fields = ['id', 'name', 'slug', 'weight', 'description', 'prefix_count', 'vlan_count']
class VLANGroupSerializer(ValidatedModelSerializer):

View File

@ -240,7 +240,7 @@ class RoleForm(BootstrapMixin, forms.ModelForm):
class Meta:
model = Role
fields = [
'name', 'slug', 'weight',
'name', 'slug', 'weight', 'description',
]

View File

@ -0,0 +1,18 @@
# Generated by Django 2.2.6 on 2019-12-10 17:56
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('ipam', '0031_3569_service_fields'),
]
operations = [
migrations.AddField(
model_name='role',
name='description',
field=models.CharField(blank=True, max_length=100),
),
]

View File

@ -260,8 +260,12 @@ class Role(ChangeLoggedModel):
weight = models.PositiveSmallIntegerField(
default=1000
)
description = models.CharField(
max_length=100,
blank=True,
)
csv_headers = ['name', 'slug', 'weight']
csv_headers = ['name', 'slug', 'weight', 'description']
class Meta:
ordering = ['weight', 'name']
@ -274,6 +278,7 @@ class Role(ChangeLoggedModel):
self.name,
self.slug,
self.weight,
self.description,
)

View File

@ -288,11 +288,15 @@ class RoleTable(BaseTable):
orderable=False,
verbose_name='VLANs'
)
actions = tables.TemplateColumn(template_code=ROLE_ACTIONS, attrs={'td': {'class': 'text-right noprint'}}, verbose_name='')
actions = tables.TemplateColumn(
template_code=ROLE_ACTIONS,
attrs={'td': {'class': 'text-right noprint'}},
verbose_name=''
)
class Meta(BaseTable.Meta):
model = Role
fields = ('pk', 'name', 'prefix_count', 'vlan_count', 'slug', 'weight', 'actions')
fields = ('pk', 'name', 'prefix_count', 'vlan_count', 'description', 'slug', 'weight', 'actions')
#