mirror of
https://github.com/netbox-community/netbox.git
synced 2024-05-10 07:54:54 +00:00
VLAN.status to slug (#3569)
This commit is contained in:
@@ -868,10 +868,10 @@ class VLAN(ChangeLoggedModel, CustomFieldModel):
|
||||
blank=True,
|
||||
null=True
|
||||
)
|
||||
status = models.PositiveSmallIntegerField(
|
||||
choices=VLAN_STATUS_CHOICES,
|
||||
default=1,
|
||||
verbose_name='Status'
|
||||
status = models.CharField(
|
||||
max_length=50,
|
||||
choices=VLANStatusChoices,
|
||||
default=VLANStatusChoices.STATUS_ACTIVE
|
||||
)
|
||||
role = models.ForeignKey(
|
||||
to='ipam.Role',
|
||||
@@ -894,6 +894,12 @@ class VLAN(ChangeLoggedModel, CustomFieldModel):
|
||||
|
||||
csv_headers = ['site', 'group_name', 'vid', 'name', 'tenant', 'status', 'role', 'description']
|
||||
|
||||
STATUS_CLASS_MAP = {
|
||||
'active': 'primary',
|
||||
'reserved': 'info',
|
||||
'deprecated': 'danger',
|
||||
}
|
||||
|
||||
class Meta:
|
||||
ordering = ['site', 'group', 'vid']
|
||||
unique_together = [
|
||||
@@ -936,7 +942,7 @@ class VLAN(ChangeLoggedModel, CustomFieldModel):
|
||||
return None
|
||||
|
||||
def get_status_class(self):
|
||||
return STATUS_CHOICE_CLASSES[self.status]
|
||||
return self.STATUS_CLASS_MAP[self.status]
|
||||
|
||||
def get_members(self):
|
||||
# Return all interfaces assigned to this VLAN
|
||||
|
Reference in New Issue
Block a user