You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was wondering about where to put validation across multiple fields for a model. Either Model.clean() or within the form (as is described in the book). I could not find any mention of Model.clean() (unless my search is broken).
Naturally I would have placed it in the model in order to benefit everywhere from this validation but according to the book it seems to be placed usually in the ModelForm.
Location within the Book
Description
I was wondering about where to put validation across multiple fields for a model. Either
Model.clean()
or within the form (as is described in the book). I could not find any mention of Model.clean()
(unless my search is broken).Naturally I would have placed it in the model in order to benefit everywhere from this validation but according to the book it seems to be placed usually in the
ModelForm
.Possible Solutions
I think the book would benefit from at least a paragraph describing what the best practice would be of where to put it.
See also: https://stackoverflow.com/questions/20017742/when-to-use-form-vs-model-validation
Your full name so we can provide accurate credit within the book
Matthias Schoettle
The text was updated successfully, but these errors were encountered: