mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-22 20:12:00 -06:00
Add description field to Role model (#3655)
This commit is contained in:
parent
1f288175e4
commit
7845d9b25f
@ -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):
|
||||
|
@ -240,7 +240,7 @@ class RoleForm(BootstrapMixin, forms.ModelForm):
|
||||
class Meta:
|
||||
model = Role
|
||||
fields = [
|
||||
'name', 'slug', 'weight',
|
||||
'name', 'slug', 'weight', 'description',
|
||||
]
|
||||
|
||||
|
||||
|
18
netbox/ipam/migrations/0032_role_description.py
Normal file
18
netbox/ipam/migrations/0032_role_description.py
Normal 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),
|
||||
),
|
||||
]
|
@ -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,
|
||||
)
|
||||
|
||||
|
||||
|
@ -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')
|
||||
|
||||
|
||||
#
|
||||
|
Loading…
Reference in New Issue
Block a user