I wanted to do field validation on a django model without using ModelForms.
Is there a way I can get the clean_fieldname method to be called when save() is invoked?
I wanted to do field validation on a django model without using ModelForms. Is
Share
The
clean_fieldnamemethod belongs on a form or a model form. There’s no code in the model to do the same thing, you’d have to implement it yourself.I recommend you write a validator for your field, then call full_clean() before saving to validate your instance.