[Solved]-Django ModelForm custom validation: How to access submitted field values



I think you want to override the clean() method on your model rather than the clean method of a specific form field. From the docs โ€“

This method should be used to provide custom model validation, and to
modify attributes on your model if desired. For instance, you could
use it to automatically provide a value for a field, or to do
validation that requires access to more than a single field.

If you did want to put the validation in the form then the clean() method on the form provides similar functionality (see docs).

๐Ÿ‘คAidan Ewen

Leave a comment