CSVChoiceField should default to a blank string instead of None

This commit is contained in:
Jeremy Stretch 2019-12-11 17:04:48 -05:00
parent 590bbbce7f
commit b16be577e3

View File

@ -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]