Documentation for ifchanged misleading
|Reported by:||Sebastian Goll||Owned by:||nobody|
|Cc:||Triage Stage:||Ready for checkin|
|Has patch:||yes||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
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.