소스 검색

Fixes #732: Allow custom select field values to be deselected if the field is not required

Jeremy Stretch 9 년 전
부모
커밋
4a9b4c5387
1개의 변경된 파일1개의 추가작업 그리고 1개의 파일을 삭제
  1. 1 1
      netbox/extras/forms.py

+ 1 - 1
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)