id summary reporter owner description type status component version severity resolution keywords cc stage has_patch needs_docs needs_tests needs_better_patch easy ui_ux 13184 Custom fields with __metaclass__ = models.SubfieldBase - ValidationError breaks out of form.is_valid() Mark Mark "According to the docstring of django.db.models.Field, django.db.models.Field.to_python ""Converts the input value into the expected Python data type, raising django.core.exceptions.ValidationError if the data can't be converted"". Declaring `__metaclass__` = SubfieldBase for the Field subclass is supposed to force the to_python conversion of the said field without having to call clean_fields, which makes sense to do for the fields that are of no meaning to you in their textual/database representation. Upon using it exactly in the way it is proposed (as illustrated in the attached test case), it appears, that if the validation fails and I raise the django.core.exceptions.ValidationError in to_python, the ValidationError somehow breaks out of the is_valid (where it is supposed to be caught and used to populate form.errors), if `__metaclass__` = SubfieldBase is declared in the Field subclass. Is this a bug in documentation or, perhaps, I am doing something wrong? I would like to stress, though, that I am doing it ""by the book"", - exactly as it is stated in the documentation without any deviations (or so I think, anyway). A somewhat unrelated question - how is it supposed to work?" closed Forms dev fixed model validation Accepted 1 0 0 0 0 0