Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add information about model validation vs form validation #219

Open
mschoettle opened this issue Mar 11, 2022 · 0 comments
Open

Add information about model validation vs form validation #219

mschoettle opened this issue Mar 11, 2022 · 0 comments

Comments

@mschoettle
Copy link

Location within the Book

  • Chapter or Appendix: n/a
  • Section: n/a
  • Subsection: n/a

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant