mirror of
https://github.com/netbox-community/netbox.git
synced 2025-08-25 08:46:10 -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'),
|
||||
)
|
||||
|
||||
def get_color(self):
|
||||
return self.color
|
||||
|
||||
def get_absolute_url(self):
|
||||
return reverse('dcim:frontport', kwargs={'pk': self.pk})
|
||||
|
||||
@ -951,9 +948,6 @@ class RearPort(ModularComponentModel, CabledObjectModel):
|
||||
ordering = ('device', '_name')
|
||||
unique_together = ('device', 'name')
|
||||
|
||||
def get_color(self):
|
||||
return self.color
|
||||
|
||||
def get_absolute_url(self):
|
||||
return reverse('dcim:rearport', kwargs={'pk': self.pk})
|
||||
|
||||
|
@ -166,9 +166,7 @@ class CableTraceSVG:
|
||||
"""
|
||||
if hasattr(instance, 'parent_object'):
|
||||
# Termination
|
||||
if(hasattr(instance, 'get_color') and instance.get_color()):
|
||||
return instance.get_color()
|
||||
return 'f0f0f0'
|
||||
return getattr(instance, 'color', 'f0f0f0') or 'f0f0f0'
|
||||
if hasattr(instance, 'device_role'):
|
||||
# Device
|
||||
return instance.device_role.color
|
||||
|
Loading…
Reference in New Issue
Block a user