#16927 closed Bug (fixed)
Documentation for ifchanged misleading
Reported by: | Sebastian Goll | Owned by: | nobody |
---|---|---|---|
Component: | Documentation | Version: | dev |
Severity: | Normal | Keywords: | ifchanged, documentation |
Cc: | 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
The multi-argument version of the template tag ifchanged
checks if any of the given variable has changed, and if so, it displays the content. However, the current documentation for this case, in the form of an example, says:
For example, the following shows the date every time it changes, but only shows the hour if both the hour and the date has changed: […]
This is misleading in so far as the wrong logical operation is described. The tag ifchanged
shows its contents if variable 1 OR variable 2 OR … has changed, not AND-ing the variables. A more accurate version of the documenting example might be:
For example, the following shows the date every time it changes, while showing the hour if either the hour or the date has changed: […]
This makes more sense anyway, since e.g. in a schedule list of dates and hours, we typically want to have the hour appear either if the date is the same and the hour changed, or the date changed. This is accomplished by the tag ifchanged
right now, the documentation should reflect this.
I am attaching a patch for the suggested change. This also includes making the wording right before the quoted text more explicit, with regard to the fact that more than one variable can be given to ifchanged
. Please check spelling and wording and make changes as appropriate since I am not a native speaker.
Attachments (1)
Change History (3)
by , 13 years ago
Attachment: | ifchanged-doc-r16901.patch added |
---|
comment:1 by , 13 years ago
Triage Stage: | Unreviewed → Ready for checkin |
---|
Thanks for the report. Your suggestions are correct. However, note that you've only modified the function's docstring and forgot to modify the actual doc in your patch. I can easily fix that when committing. Cheers!