diff options
| author | Jacob Kaplan-Moss <jacob@jacobian.org> | 2007-03-27 17:30:57 +0000 |
|---|---|---|
| committer | Jacob Kaplan-Moss <jacob@jacobian.org> | 2007-03-27 17:30:57 +0000 |
| commit | 45f9217cbd480725b0ce9d4028ee4fab7af21f11 (patch) | |
| tree | 67b553ec7b3b8386ed88bd0ff7016cf19845d8b0 /docs | |
| parent | d6fd9fb22bdbc6939fbe97c6e0571b8002d014c6 (diff) | |
Cleaned up the docs from [4830] a bit.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4831 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/templates.txt | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/docs/templates.txt b/docs/templates.txt index 37fd1cdea4..005784a5eb 100644 --- a/docs/templates.txt +++ b/docs/templates.txt @@ -877,16 +877,17 @@ with **New in Django development version** -Useful for caching a method which will be used more than once. +Caches a complex variable under a simpler name. This is useful when accessing +an "expensive" method (e.g. one that hits the database) multiple times. For example:: - {% with person.some_sql_method as total %} - {{ total }} person object{{ total|pluralize }} + {% with business.employees.count as total %} + {{ total }} employee{{ total|pluralize }} {% endwith %} The populated variable (in the example above, ``total``) is only available -inside of ``{% with %}`` block. +inside of the ``{% with %}`` block. Built-in filter reference ------------------------- |
