diff options
| author | Tim Graham <timograham@gmail.com> | 2017-10-24 13:25:55 -0400 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2017-10-25 14:21:27 -0400 |
| commit | 01987bc0b4156b0ed24cd1654ca7f672c4171e94 (patch) | |
| tree | d6664d5fdd60d1897822169ec14c312c526ea47e /docs/topics | |
| parent | c4f518e484a948af9c2fe370896c3e2ddb492d40 (diff) | |
[2.0.x] Fixed #28737 -- Clarified {% cache %} tag's handling of arguments.
Thanks Tom Aratyn for the report.
Backport of 171c7cc863eafc2346aa84ffd1d540644539f1a4 from master
Diffstat (limited to 'docs/topics')
| -rw-r--r-- | docs/topics/cache.txt | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/docs/topics/cache.txt b/docs/topics/cache.txt index 6e6564d3e2..61f8a0779d 100644 --- a/docs/topics/cache.txt +++ b/docs/topics/cache.txt @@ -677,8 +677,9 @@ example: Sometimes you might want to cache multiple copies of a fragment depending on some dynamic data that appears inside the fragment. For example, you might want a separate cached copy of the sidebar used in the previous example for every user -of your site. Do this by passing additional arguments to the ``{% cache %}`` -template tag to uniquely identify the cache fragment: +of your site. Do this by passing one or more additional arguments, which may be +variables with or without filters, to the ``{% cache %}`` template tag to +uniquely identify the cache fragment: .. code-block:: html+django @@ -687,9 +688,6 @@ template tag to uniquely identify the cache fragment: .. sidebar for logged in user .. {% endcache %} -It's perfectly fine to specify more than one argument to identify the fragment. -Simply pass as many arguments to ``{% cache %}`` as you need. - If :setting:`USE_I18N` is set to ``True`` the per-site middleware cache will :ref:`respect the active language<i18n-cache-key>`. For the ``cache`` template tag you could use one of the |
