Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#16927 closed Bug (fixed)

Documentation for ifchanged misleading

Reported by: Sebastian Goll Owned by: nobody
Component: Documentation Version: master
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


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)

ifchanged-doc-r16901.patch (901 bytes) - added by Sebastian Goll 7 years ago.

Download all attachments as: .zip

Change History (3)

Changed 7 years ago by Sebastian Goll

Attachment: ifchanged-doc-r16901.patch added

comment:1 Changed 7 years ago by Julien Phalip

Triage Stage: UnreviewedReady 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!

comment:2 Changed 7 years ago by Julien Phalip

Resolution: fixed
Status: newclosed

In [16902]:

(The changeset message doesn't reference this ticket)

Note: See TracTickets for help on using tickets.
Back to Top