Support CSS class definition directly in CHOICES iterable

This commit is contained in:
jeremystretch
2021-12-16 10:03:23 -05:00
parent acba80f38a
commit 26823615ad
19 changed files with 110 additions and 214 deletions

View File

@@ -16,19 +16,10 @@ class VirtualMachineStatusChoices(ChoiceSet):
STATUS_DECOMMISSIONING = 'decommissioning'
CHOICES = [
(STATUS_OFFLINE, 'Offline'),
(STATUS_ACTIVE, 'Active'),
(STATUS_PLANNED, 'Planned'),
(STATUS_STAGED, 'Staged'),
(STATUS_FAILED, 'Failed'),
(STATUS_DECOMMISSIONING, 'Decommissioning'),
(STATUS_OFFLINE, 'Offline', 'warning'),
(STATUS_ACTIVE, 'Active', 'success'),
(STATUS_PLANNED, 'Planned', 'info'),
(STATUS_STAGED, 'Staged', 'primary'),
(STATUS_FAILED, 'Failed', 'danger'),
(STATUS_DECOMMISSIONING, 'Decommissioning', 'warning'),
]
CSS_CLASSES = {
STATUS_OFFLINE: 'warning',
STATUS_ACTIVE: 'success',
STATUS_PLANNED: 'info',
STATUS_STAGED: 'primary',
STATUS_FAILED: 'danger',
STATUS_DECOMMISSIONING: 'warning',
}