Code

Opened 3 years ago

Closed 3 years ago

Last modified 3 years ago

#16927 closed Bug (fixed)

Documentation for ifchanged misleading

Reported by: sebastian 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

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)

ifchanged-doc-r16901.patch (901 bytes) - added by sebastian 3 years ago.

Download all attachments as: .zip

Change History (3)

Changed 3 years ago by sebastian

comment:1 Changed 3 years ago by julien

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to 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!

comment:2 Changed 3 years ago by julien

  • Resolution set to fixed
  • Status changed from new to closed

In [16902]:

Fixed #16927 -- Corrected the {% ifchanged %} template tag's documentation. Thanks to sebastian for the report and patch.

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.