Explorar o código

CSVChoiceField should default to a blank string instead of None

Jeremy Stretch %!s(int64=6) %!d(string=hai) anos
pai
achega
b16be577e3
Modificáronse 1 ficheiros con 1 adicións e 1 borrados
  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):
     def clean(self, value):
         value = super().clean(value)
         value = super().clean(value)
         if not value:
         if not value:
-            return None
+            return ''
         if value not in self.choice_values:
         if value not in self.choice_values:
             raise forms.ValidationError("Invalid choice: {}".format(value))
             raise forms.ValidationError("Invalid choice: {}".format(value))
         return self.choice_values[value]
         return self.choice_values[value]