From c6467a824b09f91b137b96e2325ead1ae14cab23 Mon Sep 17 00:00:00 2001 From: jeremystretch Date: Wed, 5 Jan 2022 17:10:59 -0500 Subject: [PATCH] #8228: Always add a blank choice --- netbox/extras/scripts.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/netbox/extras/scripts.py b/netbox/extras/scripts.py index 572dcd835..3c7ad3c15 100644 --- a/netbox/extras/scripts.py +++ b/netbox/extras/scripts.py @@ -164,8 +164,8 @@ class ChoiceVar(ScriptVariable): def __init__(self, choices, *args, **kwargs): super().__init__(*args, **kwargs) - # Set field choices. Add a blank choice if this field is not required. - self.field_attrs['choices'] = choices if kwargs.get('required') else add_blank_choice(choices) + # Set field choices, adding a blank choice to avoid forced selections + self.field_attrs['choices'] = add_blank_choice(choices) class MultiChoiceVar(ScriptVariable):