From 4a9b4c5387aace8eb72cfbda3aad76e5a3896ef4 Mon Sep 17 00:00:00 2001 From: Jeremy Stretch Date: Wed, 7 Dec 2016 14:00:52 -0500 Subject: [PATCH] Fixes #732: Allow custom select field values to be deselected if the field is not required --- netbox/extras/forms.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/netbox/extras/forms.py b/netbox/extras/forms.py index d7a37dacd..9d738219d 100644 --- a/netbox/extras/forms.py +++ b/netbox/extras/forms.py @@ -49,7 +49,7 @@ def get_custom_fields_for_model(content_type, filterable_only=False, bulk_edit=F # Select elif cf.type == CF_TYPE_SELECT: choices = [(cfc.pk, cfc) for cfc in cf.choices.all()] - if bulk_edit or filterable_only: + if not cf.required or bulk_edit or filterable_only: choices = [(None, '---------')] + choices field = forms.TypedChoiceField(choices=choices, coerce=int, required=cf.required)