mirror of
https://github.com/django/django.git
synced 2025-09-26 12:09:19 +00:00
Fixed #3826: added a {% with %}. Thanks, SmileyChris.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4830 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
750ea554c1
commit
d6fd9fb22b
3 changed files with 57 additions and 0 deletions
|
@ -872,6 +872,22 @@ Above, if ``this_value`` is 175 and ``max_value`` is 200, the the image in the
|
|||
above example will be 88 pixels wide (because 175/200 = .875; .875 * 100 = 87.5
|
||||
which is rounded up to 88).
|
||||
|
||||
with
|
||||
~~~~
|
||||
|
||||
**New in Django development version**
|
||||
|
||||
Useful for caching a method which will be used more than once.
|
||||
|
||||
For example::
|
||||
|
||||
{% with person.some_sql_method as total %}
|
||||
{{ total }} person object{{ total|pluralize }}
|
||||
{% endwith %}
|
||||
|
||||
The populated variable (in the example above, ``total``) is only available
|
||||
inside of ``{% with %}`` block.
|
||||
|
||||
Built-in filter reference
|
||||
-------------------------
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue