mirror of
https://github.com/netbox-community/netbox.git
synced 2025-08-26 01:06:11 -06:00
Simplify termination color resolution
This commit is contained in:
parent
00cf5642a0
commit
ddfdf61342
@ -902,9 +902,6 @@ class FrontPort(ModularComponentModel, CabledObjectModel):
|
|||||||
('rear_port', 'rear_port_position'),
|
('rear_port', 'rear_port_position'),
|
||||||
)
|
)
|
||||||
|
|
||||||
def get_color(self):
|
|
||||||
return self.color
|
|
||||||
|
|
||||||
def get_absolute_url(self):
|
def get_absolute_url(self):
|
||||||
return reverse('dcim:frontport', kwargs={'pk': self.pk})
|
return reverse('dcim:frontport', kwargs={'pk': self.pk})
|
||||||
|
|
||||||
@ -951,9 +948,6 @@ class RearPort(ModularComponentModel, CabledObjectModel):
|
|||||||
ordering = ('device', '_name')
|
ordering = ('device', '_name')
|
||||||
unique_together = ('device', 'name')
|
unique_together = ('device', 'name')
|
||||||
|
|
||||||
def get_color(self):
|
|
||||||
return self.color
|
|
||||||
|
|
||||||
def get_absolute_url(self):
|
def get_absolute_url(self):
|
||||||
return reverse('dcim:rearport', kwargs={'pk': self.pk})
|
return reverse('dcim:rearport', kwargs={'pk': self.pk})
|
||||||
|
|
||||||
|
@ -166,9 +166,7 @@ class CableTraceSVG:
|
|||||||
"""
|
"""
|
||||||
if hasattr(instance, 'parent_object'):
|
if hasattr(instance, 'parent_object'):
|
||||||
# Termination
|
# Termination
|
||||||
if(hasattr(instance, 'get_color') and instance.get_color()):
|
return getattr(instance, 'color', 'f0f0f0') or 'f0f0f0'
|
||||||
return instance.get_color()
|
|
||||||
return 'f0f0f0'
|
|
||||||
if hasattr(instance, 'device_role'):
|
if hasattr(instance, 'device_role'):
|
||||||
# Device
|
# Device
|
||||||
return instance.device_role.color
|
return instance.device_role.color
|
||||||
|
Loading…
Reference in New Issue
Block a user