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

Closes #8495: Enable custom field grouping

This commit is contained in:
jeremystretch
2022-04-15 14:45:28 -04:00
parent 4fac10ac4a
commit 17df8a5c43
13 changed files with 119 additions and 56 deletions

View File

@ -79,6 +79,11 @@ class CustomField(ExportTemplatesMixin, WebhooksMixin, ChangeLoggedModel):
help_text='Name of the field as displayed to users (if not provided, '
'the field\'s name will be used)'
)
group_name = models.CharField(
max_length=50,
blank=True,
help_text="Custom fields within the same group will be displayed together"
)
description = models.CharField(
max_length=200,
blank=True
@ -134,7 +139,7 @@ class CustomField(ExportTemplatesMixin, WebhooksMixin, ChangeLoggedModel):
objects = CustomFieldManager()
class Meta:
ordering = ['weight', 'name']
ordering = ['group_name', 'weight', 'name']
def __str__(self):
return self.label or self.name.replace('_', ' ').capitalize()