Просмотр исходного кода

CSVChoiceField should default to a blank string instead of None

Jeremy Stretch 6 лет назад
Родитель
Сommit
b16be577e3
1 измененных файлов с 1 добавлено и 1 удалено
  1. 1 1
      netbox/utilities/forms.py

+ 1 - 1
netbox/utilities/forms.py

@@ -432,7 +432,7 @@ class CSVChoiceField(forms.ChoiceField):
     def clean(self, value):
         value = super().clean(value)
         if not value:
-            return None
+            return ''
         if value not in self.choice_values:
             raise forms.ValidationError("Invalid choice: {}".format(value))
         return self.choice_values[value]