diff options
| author | Keshav Kumar <https://github.com/keshav2212> | 2020-02-02 22:18:07 +0530 |
|---|---|---|
| committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2020-02-18 06:56:05 +0100 |
| commit | f37d548ede290690589e86b892c4f106e2a8e1bc (patch) | |
| tree | 693f0ac6a43a19daf06c5826d32f51107e1e71b1 /docs | |
| parent | 86908785076b2bbc31b908781da6b6ad1779b18b (diff) | |
Fixed #20995 -- Added support for iterables of template names to {% include %} template tag.
Thanks Adam Johnson for the review.
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/ref/templates/builtins.txt | 8 | ||||
| -rw-r--r-- | docs/releases/3.1.txt | 2 |
2 files changed, 10 insertions, 0 deletions
diff --git a/docs/ref/templates/builtins.txt b/docs/ref/templates/builtins.txt index 4d65dc82f7..7172bfc3f2 100644 --- a/docs/ref/templates/builtins.txt +++ b/docs/ref/templates/builtins.txt @@ -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`` diff --git a/docs/releases/3.1.txt b/docs/releases/3.1.txt index df7aad8dd2..444cba34dc 100644 --- a/docs/releases/3.1.txt +++ b/docs/releases/3.1.txt @@ -322,6 +322,8 @@ Templates and :ttag:`blocktrans` template tags aliases continue to work, and will be retained for the foreseeable future. +* The :ttag:`include` template tag now accepts iterables of template names. + Tests ~~~~~ |
