Permalink
Browse files

Cleaned up the docs from [4830] a bit.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@4831 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
1 parent d6fd9fb commit 45f9217cbd480725b0ce9d4028ee4fab7af21f11 @jacobian jacobian committed Mar 27, 2007
Showing with 5 additions and 4 deletions.
  1. +5 −4 docs/templates.txt
View
@@ -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
-------------------------

0 comments on commit 45f9217

Please sign in to comment.