#22473 closed Uncategorized (fixed)
Docs for Model.clean() are misleading
Reported by: | anonymous | Owned by: | nobody |
---|---|---|---|
Component: | Documentation | Version: | 1.6 |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
from https://docs.djangoproject.com/en/1.6/ref/models/instances/#django.db.models.Model.clean
Model.clean()
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...
This is misleading, as it seems to say that Model.clean() is called when saving an object. It should be made clear here that clean() is for validation in forms.
Here's someone else who has run into this misunderstanding: http://stackoverflow.com/questions/18803112/django-doesnt-call-model-clean-method
In b43bbd6d399c9ecca09c2e181715c8856ef5a598: