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:
Jacob Kaplan-Moss 2007-03-27 17:25:56 +00:00
parent 750ea554c1
commit d6fd9fb22b
3 changed files with 57 additions and 0 deletions

View file

@ -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
-------------------------