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

add color to ChangeActionChoices #12828

This commit is contained in:
Abhimanyu Saharan
2023-06-14 13:36:30 +05:30
committed by Jeremy Stretch
parent 4d686e8162
commit 93175888f0
2 changed files with 6 additions and 3 deletions

View File

@ -210,7 +210,7 @@ class ChangeActionChoices(ChoiceSet):
ACTION_DELETE = 'delete'
CHOICES = (
(ACTION_CREATE, 'Create'),
(ACTION_UPDATE, 'Update'),
(ACTION_DELETE, 'Delete'),
(ACTION_CREATE, 'Create', 'green'),
(ACTION_UPDATE, 'Update', 'blue'),
(ACTION_DELETE, 'Delete', 'red'),
)

View File

@ -112,3 +112,6 @@ class StagedChange(ChangeLoggedModel):
instance = self.model.objects.get(pk=self.object_id)
logger.info(f'Deleting {self.model._meta.verbose_name} {instance}')
instance.delete()
def get_action_color(self):
return ChangeActionChoices.colors.get(self.action)