mirror of
https://github.com/django/django.git
synced 2025-04-25 17:54:37 +00:00
Fixed #16927 -- Corrected the {% ifchanged %}
template tag's documentation. Thanks to sebastian for the report and patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@16902 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
4c457bca85
commit
482388cd61
@ -936,7 +936,8 @@ def ifchanged(parser, token):
|
|||||||
"""
|
"""
|
||||||
Checks if a value has changed from the last iteration of a loop.
|
Checks if a value has changed from the last iteration of a loop.
|
||||||
|
|
||||||
The 'ifchanged' block tag is used within a loop. It has two possible uses.
|
The ``{% ifchanged %}`` block tag is used within a loop. It has two
|
||||||
|
possible uses.
|
||||||
|
|
||||||
1. Checks its own rendered contents against its previous state and only
|
1. Checks its own rendered contents against its previous state and only
|
||||||
displays the content if it has changed. For example, this displays a
|
displays the content if it has changed. For example, this displays a
|
||||||
@ -949,9 +950,9 @@ def ifchanged(parser, token):
|
|||||||
<a href="{{ date|date:"M/d"|lower }}/">{{ date|date:"j" }}</a>
|
<a href="{{ date|date:"M/d"|lower }}/">{{ date|date:"j" }}</a>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
||||||
2. If given a variable, check whether that variable has changed.
|
2. If given one or more variables, check whether any variable has changed.
|
||||||
For example, the following shows the date every time it changes, but
|
For example, the following shows the date every time it changes, while
|
||||||
only shows the hour if both the hour and the date have changed::
|
showing the hour if either the hour or the date has changed::
|
||||||
|
|
||||||
{% for date in days %}
|
{% for date in days %}
|
||||||
{% ifchanged date.date %} {{ date.date }} {% endifchanged %}
|
{% ifchanged date.date %} {{ date.date }} {% endifchanged %}
|
||||||
|
@ -555,7 +555,8 @@ ifchanged
|
|||||||
|
|
||||||
Check if a value has changed from the last iteration of a loop.
|
Check if a value has changed from the last iteration of a loop.
|
||||||
|
|
||||||
The 'ifchanged' block tag is used within a loop. It has two possible uses.
|
The ``{% ifchanged %}`` block tag is used within a loop. It has two possible
|
||||||
|
uses.
|
||||||
|
|
||||||
1. Checks its own rendered contents against its previous state and only
|
1. Checks its own rendered contents against its previous state and only
|
||||||
displays the content if it has changed. For example, this displays a list of
|
displays the content if it has changed. For example, this displays a list of
|
||||||
@ -568,9 +569,9 @@ The 'ifchanged' block tag is used within a loop. It has two possible uses.
|
|||||||
<a href="{{ date|date:"M/d"|lower }}/">{{ date|date:"j" }}</a>
|
<a href="{{ date|date:"M/d"|lower }}/">{{ date|date:"j" }}</a>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
||||||
2. If given a variable, check whether that variable has changed. For
|
2. If given one or more variables, check whether any variable has changed.
|
||||||
example, the following shows the date every time it changes, but
|
For example, the following shows the date every time it changes, while
|
||||||
only shows the hour if both the hour and the date has changed::
|
showing the hour if either the hour or the date has changed::
|
||||||
|
|
||||||
{% for date in days %}
|
{% for date in days %}
|
||||||
{% ifchanged date.date %} {{ date.date }} {% endifchanged %}
|
{% ifchanged date.date %} {{ date.date }} {% endifchanged %}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user