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

Fixes #13864: Remove 'default' choice for dashboard widget color

This commit is contained in:
Jeremy Stretch
2023-09-22 08:46:42 -04:00
parent db40119faa
commit 4dd229e73a
2 changed files with 38 additions and 2 deletions

View File

@ -244,3 +244,39 @@ class ChangeActionChoices(ChoiceSet):
(ACTION_UPDATE, _('Update'), 'blue'), (ACTION_UPDATE, _('Update'), 'blue'),
(ACTION_DELETE, _('Delete'), 'red'), (ACTION_DELETE, _('Delete'), 'red'),
) )
#
# Dashboard widgets
#
class DashboardWidgetColorChoices(ChoiceSet):
BLUE = 'blue'
INDIGO = 'indigo'
PURPLE = 'purple'
PINK = 'pink'
RED = 'red'
ORANGE = 'orange'
YELLOW = 'yellow'
GREEN = 'green'
TEAL = 'teal'
CYAN = 'cyan'
GRAY = 'gray'
BLACK = 'black'
WHITE = 'white'
CHOICES = (
(BLUE, _('Blue')),
(INDIGO, _('Indigo')),
(PURPLE, _('Purple')),
(PINK, _('Pink')),
(RED, _('Red')),
(ORANGE, _('Orange')),
(YELLOW, _('Yellow')),
(GREEN, _('Green')),
(TEAL, _('Teal')),
(CYAN, _('Cyan')),
(GRAY, _('Gray')),
(BLACK, _('Black')),
(WHITE, _('White')),
)

View File

@ -2,9 +2,9 @@ from django import forms
from django.urls import reverse_lazy from django.urls import reverse_lazy
from django.utils.translation import gettext as _ from django.utils.translation import gettext as _
from extras.choices import DashboardWidgetColorChoices
from netbox.registry import registry from netbox.registry import registry
from utilities.forms import BootstrapMixin, add_blank_choice from utilities.forms import BootstrapMixin, add_blank_choice
from utilities.choices import ButtonColorChoices
__all__ = ( __all__ = (
'DashboardWidgetAddForm', 'DashboardWidgetAddForm',
@ -21,7 +21,7 @@ class DashboardWidgetForm(BootstrapMixin, forms.Form):
required=False required=False
) )
color = forms.ChoiceField( color = forms.ChoiceField(
choices=add_blank_choice(ButtonColorChoices), choices=add_blank_choice(DashboardWidgetColorChoices),
required=False, required=False,
) )