Skip to content

Commit

Permalink
Fixes #13864: Remove 'default' choice for dashboard widget color
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremystretch committed Sep 22, 2023
1 parent 9b325f4 commit 77c741b
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 2 deletions.
36 changes: 36 additions & 0 deletions netbox/extras/choices.py
Original file line number Diff line number Diff line change
Expand Up @@ -244,3 +244,39 @@ class ChangeActionChoices(ChoiceSet):
(ACTION_UPDATE, _('Update'), 'blue'),
(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')),
)
4 changes: 2 additions & 2 deletions netbox/extras/dashboard/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
from django.urls import reverse_lazy
from django.utils.translation import gettext as _

from extras.choices import DashboardWidgetColorChoices
from netbox.registry import registry
from utilities.forms import BootstrapMixin, add_blank_choice
from utilities.choices import ButtonColorChoices

__all__ = (
'DashboardWidgetAddForm',
Expand All @@ -21,7 +21,7 @@ class DashboardWidgetForm(BootstrapMixin, forms.Form):
required=False
)
color = forms.ChoiceField(
choices=add_blank_choice(ButtonColorChoices),
choices=add_blank_choice(DashboardWidgetColorChoices),
required=False,
)

Expand Down

0 comments on commit 77c741b

Please sign in to comment.