7👍
✅
Thanks for the comment. Yes I found that ModelChoiceField
is used to ManyToMany
fields in models. On the form side, it is represented as MultipleChoiceField/TypedMultipleChoiceField
.
So I decided to subclass this field and override validate methods
.
class NotValidatedMultipleChoiceFiled(forms.TypedMultipleChoiceField):
"""Field that do not validate if the field values are in self.choices"""
def to_python(self, value):
"""Override checking method"""
return map(self.coerce, value)
def validate(self, value):
"""Nothing to do here"""
pass
Source:stackexchange.com