Opened 12 years ago
Closed 12 years ago
#18917 closed Cleanup/optimization (fixed)
confusing documentation for clean_<fieldname>()
Reported by: | Sergiy Kuzmenko | Owned by: | nobody |
---|---|---|---|
Component: | Documentation | Version: | 1.4 |
Severity: | Normal | Keywords: | forms, validation, documentation |
Cc: | bradpitcher@… | Triage Stage: | Ready for checkin |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | yes | UI/UX: | no |
Description
On https://docs.djangoproject.com/en/1.4/ref/forms/validation/ under the clean_<fieldname>() section it says:
Just like the general field clean() method, above, this method should return the cleaned data, regardless of whether it changed anything or not.
However the in the context of clean() cleaned data refers to the dictionary and in the context of clean_<fieldname>() it refers to a single cleaned value. So how about we change that phrase to this:
This method should return the cleaned value obtained from cleaned_data, regardless of whether it changed anything or not.
Change History (4)
comment:1 by , 12 years ago
Cc: | added |
---|---|
Needs documentation: | set |
Owner: | changed from | to
Status: | new → assigned |
comment:2 by , 12 years ago
Has patch: | set |
---|---|
Needs documentation: | unset |
Owner: | changed from | to
Status: | assigned → new |
Needs review:
https://github.com/django/django/pull/333
comment:3 by , 12 years ago
Triage Stage: | Unreviewed → Ready for checkin |
---|
Looks good to me, much less ambiguous.
comment:4 by , 12 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Pull request merged, but closing the ticket has been forgotten.
I agree, the docs for both methods talk about returning "cleaned data", but it's different data from each method. Your suggestion clears up the ambiguity.