Fixed #28737 -- Clarified {% cache %} tag's handling of arguments.
Thanks Tom Aratyn for the report.
This commit is contained in:
parent
3642c3758b
commit
171c7cc863
|
@ -660,8 +660,9 @@ example:
|
||||||
Sometimes you might want to cache multiple copies of a fragment depending on
|
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
|
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
|
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 %}``
|
of your site. Do this by passing one or more additional arguments, which may be
|
||||||
template tag to uniquely identify the cache fragment:
|
variables with or without filters, to the ``{% cache %}`` template tag to
|
||||||
|
uniquely identify the cache fragment:
|
||||||
|
|
||||||
.. code-block:: html+django
|
.. code-block:: html+django
|
||||||
|
|
||||||
|
@ -670,9 +671,6 @@ template tag to uniquely identify the cache fragment:
|
||||||
.. sidebar for logged in user ..
|
.. sidebar for logged in user ..
|
||||||
{% endcache %}
|
{% 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
|
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
|
:ref:`respect the active language<i18n-cache-key>`. For the ``cache`` template
|
||||||
tag you could use one of the
|
tag you could use one of the
|
||||||
|
|
Loading…
Reference in New Issue