Django

Code

Changeset 4831

Show
Ignore:
Timestamp:
03/27/07 12:30:57 (1 year ago)
Author:
jacob
Message:

Cleaned up the docs from [4830] a bit.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • django/trunk/docs/templates.txt

    r4830 r4831  
    878878**New in Django development version** 
    879879 
    880 Useful for caching a method which will be used more than once. 
     880Caches a complex variable under a simpler name. This is useful when accessing 
     881an "expensive" method (e.g. one that hits the database) multiple times. 
    881882 
    882883For example:: 
    883884 
    884     {% with person.some_sql_method as total %} 
    885         {{ total }} person object{{ total|pluralize }} 
     885    {% with business.employees.count as total %} 
     886        {{ total }} employee{{ total|pluralize }} 
    886887    {% endwith %} 
    887888 
    888889The populated variable (in the example above, ``total``) is only available 
    889 inside of ``{% with %}`` block. 
     890inside of the ``{% with %}`` block. 
    890891 
    891892Built-in filter reference