Fixed #20995 -- Added support for iterables of template names to {% include %} template tag.

Thanks Adam Johnson for the review.
This commit is contained in:
Keshav Kumar 2020-02-02 22:18:07 +05:30 committed by Mariusz Felisiak
parent 8690878507
commit f37d548ede
4 changed files with 37 additions and 3 deletions

View file

@ -688,6 +688,10 @@ the variable ``template_name``::
The variable may also be any object with a ``render()`` method that accepts a
context. This allows you to reference a compiled ``Template`` in your context.
Additionally, the variable may be an iterable of template names, in which case
the first that can be loaded will be used, as per
:func:`~django.template.loader.select_template`.
An included template is rendered within the context of the template that
includes it. This example produces the output ``"Hello, John!"``:
@ -724,6 +728,10 @@ available to the included template::
been evaluated and rendered* - not blocks that can be overridden by, for
example, an extending template.
.. versionchanged:: 3.1
Support for iterables of template names was added.
.. templatetag:: load
``load``