From 9e086932d9ab1cccf783b99c8675f4add57d14ca Mon Sep 17 00:00:00 2001 From: Joseph Kennedy Date: Mon, 28 Aug 2017 02:24:50 -0400 Subject: [PATCH] Added get_status_class to template code and change to CustomFieldModel for InterfaceModel --- netbox/dcim/models.py | 5 ++++- netbox/dcim/tables.py | 3 +-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/netbox/dcim/models.py b/netbox/dcim/models.py index 1ca561280..c396be3a2 100644 --- a/netbox/dcim/models.py +++ b/netbox/dcim/models.py @@ -1121,7 +1121,7 @@ class PowerOutlet(models.Model): # @python_2_unicode_compatible -class Interface(models.Model): +class Interface(CreatedUpdatedModel, CustomFieldModel): """ A physical data interface within a Device. An Interface can connect to exactly one other Interface via the creation of an InterfaceConnection. @@ -1209,6 +1209,9 @@ class Interface(models.Model): pass return bool(self.connection) + def get_status_class(self): + return IFACE_ENABLED_CHOICES[self.enabled] + @property def connection(self): try: diff --git a/netbox/dcim/tables.py b/netbox/dcim/tables.py index 599ff878e..29fefc1f8 100644 --- a/netbox/dcim/tables.py +++ b/netbox/dcim/tables.py @@ -104,7 +104,7 @@ DEVICE_STATUS = """ """ INTERFACE_ENABLED = """ -{{ record.get_status_display }} +{{ record.enabled }} """ DEVICE_PRIMARY_IP = """ @@ -540,7 +540,6 @@ class InterfaceImportTable(BaseTable): args=[Accessor('interface.device.pk')], verbose_name='Device') lag = tables.LinkColumn('dcim:interface', accessor=Accessor('self.name'), args=[Accessor('self.pk')], verbose_name='Lag ID') - #lag = tables.Column(verbose_name='Lag ID') name = tables.Column(verbose_name='Interface') mac_address = tables.Column(verbose_name='MAC Address') form_factor = tables.Column(verbose_name='Form Factor')