mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-24 17:38:37 -06:00
BooleanVar cannot be required
This commit is contained in:
parent
c62a9f1b3f
commit
950a09895b
@ -19,10 +19,6 @@ __all__ = [
|
|||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
class OptionalBooleanField(forms.BooleanField):
|
|
||||||
required = False
|
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Script variables
|
# Script variables
|
||||||
#
|
#
|
||||||
@ -96,7 +92,13 @@ class BooleanVar(ScriptVariable):
|
|||||||
"""
|
"""
|
||||||
Boolean representation (true/false). Renders as a checkbox.
|
Boolean representation (true/false). Renders as a checkbox.
|
||||||
"""
|
"""
|
||||||
form_field = OptionalBooleanField
|
form_field = forms.BooleanField
|
||||||
|
|
||||||
|
def __init__(self, *args, **kwargs):
|
||||||
|
super().__init__(*args, **kwargs)
|
||||||
|
|
||||||
|
# Boolean fields cannot be required
|
||||||
|
self.field_attrs['required'] = False
|
||||||
|
|
||||||
|
|
||||||
class ObjectVar(ScriptVariable):
|
class ObjectVar(ScriptVariable):
|
||||||
|
Loading…
Reference in New Issue
Block a user