mirror of
https://github.com/netbox-community/netbox.git
synced 2025-08-07 08:08:15 -06:00
Added get_status_class to template code and change to CustomFieldModel for InterfaceModel
This commit is contained in:
parent
271c771b76
commit
9e086932d9
@ -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:
|
||||
|
@ -104,7 +104,7 @@ DEVICE_STATUS = """
|
||||
"""
|
||||
|
||||
INTERFACE_ENABLED = """
|
||||
<span class="label label-{{ record.get_status_class }}">{{ record.get_status_display }}</span>
|
||||
<span class="label label-{{ record.get_status_class }}">{{ record.enabled }}</span>
|
||||
"""
|
||||
|
||||
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')
|
||||
|
Loading…
Reference in New Issue
Block a user