[Solved]-Django model validation not working


The documentation is explicit about this:

Note that validators will not be run automatically when you save a model, but if you are using a ModelForm, it will run your validators on any fields that are included in your form.

It’s your responsibility to call the clean methods before saving if you’re not using a form.

Calling the model validators can be forced like this:


Leave a comment