Simplify termination color resolution

This commit is contained in:
jeremystretch 2022-11-16 09:57:02 -05:00
parent 00cf5642a0
commit ddfdf61342
2 changed files with 1 additions and 9 deletions

View File

@ -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})

View File

@ -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