mirror of
https://github.com/netbox-community/netbox.git
synced 2024-05-10 07:54:54 +00:00
Fixed default value for boolean fields
This commit is contained in:
@ -25,7 +25,14 @@ def get_custom_fields_for_model(content_type, bulk_editing=False):
|
||||
(True, 'True'),
|
||||
(False, 'False'),
|
||||
)
|
||||
field = forms.NullBooleanField(required=cf.required, widget=forms.Select(choices=choices))
|
||||
if cf.default.lower() in ['true', 'yes', '1']:
|
||||
initial = True
|
||||
elif cf.default.lower() in ['false', 'no', '0']:
|
||||
initial = False
|
||||
else:
|
||||
initial = None
|
||||
field = forms.NullBooleanField(required=cf.required, initial=initial,
|
||||
widget=forms.Select(choices=choices))
|
||||
|
||||
# Date
|
||||
elif cf.type == CF_TYPE_DATE:
|
||||
|
Reference in New Issue
Block a user