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?
The clean_fieldname method 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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With