1
0
mirror of https://github.com/netbox-community/netbox.git synced 2024-05-10 07:54:54 +00:00

Improve ChoiceFieldColumn to not rely on model method to derive label color

This commit is contained in:
jeremystretch
2022-02-10 16:29:19 -05:00
parent f111380674
commit 71d3dc6e44
14 changed files with 19 additions and 58 deletions

View File

@@ -286,9 +286,6 @@ class Cable(NetBoxModel):
# Update the private pk used in __str__ in case this is a new object (i.e. just got its pk)
self._pk = self.pk
def get_status_class(self):
return LinkStatusChoices.colors.get(self.status)
def get_compatible_types(self):
"""
Return all termination types compatible with termination A.

View File

@@ -1001,9 +1001,6 @@ class Device(NetBoxModel, ConfigContextModel):
"""
return Device.objects.filter(parent_bay__device=self.pk)
def get_status_class(self):
return DeviceStatusChoices.colors.get(self.status, 'secondary')
class Module(NetBoxModel, ConfigContextModel):
"""

View File

@@ -169,9 +169,3 @@ class PowerFeed(NetBoxModel, PathEndpoint, LinkTermination):
@property
def parent_object(self):
return self.power_panel
def get_type_class(self):
return PowerFeedTypeChoices.colors.get(self.type)
def get_status_class(self):
return PowerFeedStatusChoices.colors.get(self.status, 'secondary')

View File

@@ -247,9 +247,6 @@ class Rack(NetBoxModel):
else:
return reversed(range(1, self.u_height + 1))
def get_status_class(self):
return RackStatusChoices.colors.get(self.status, 'secondary')
def get_rack_units(self, user=None, face=DeviceFaceChoices.FACE_FRONT, exclude=None, expand_devices=True):
"""
Return a list of rack units as dictionaries. Example: {'device': None, 'face': 0, 'id': 48, 'name': 'U48'}

View File

@@ -309,9 +309,6 @@ class Site(NetBoxModel):
def get_absolute_url(self):
return reverse('dcim:site', args=[self.pk])
def get_status_class(self):
return SiteStatusChoices.colors.get(self.status, 'secondary')
#
# Locations