mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-15 11:42:52 -06:00
#8228: Always add a blank choice
This commit is contained in:
parent
b1d1f3c6b2
commit
c6467a824b
@ -164,8 +164,8 @@ class ChoiceVar(ScriptVariable):
|
|||||||
def __init__(self, choices, *args, **kwargs):
|
def __init__(self, choices, *args, **kwargs):
|
||||||
super().__init__(*args, **kwargs)
|
super().__init__(*args, **kwargs)
|
||||||
|
|
||||||
# Set field choices. Add a blank choice if this field is not required.
|
# Set field choices, adding a blank choice to avoid forced selections
|
||||||
self.field_attrs['choices'] = choices if kwargs.get('required') else add_blank_choice(choices)
|
self.field_attrs['choices'] = add_blank_choice(choices)
|
||||||
|
|
||||||
|
|
||||||
class MultiChoiceVar(ScriptVariable):
|
class MultiChoiceVar(ScriptVariable):
|
||||||
|
Loading…
Reference in New Issue
Block a user