[Answer]-Custom Form Field in Django

1👍

I don’t know if it’s a typo or you intended that way but actually empty_values (in plural) is not defined in your code anywhere. I also take a look at the source code of the super class MultipleChoiceField and is not defined there either.

What I could find in the super super class of your class (ChoiceField) was a reference to validator.EMPTY_VALUES and of course, it is in capital letters.

The line more alike yours in the source code was this one:

if value == self.empty_value or value in validators.EMPTY_VALUES:

Take a look deep in your code and see if that was what you intended to do.

Hope this helps!

Leave a comment