mirror of
https://github.com/django/django.git
synced 2025-10-24 06:06:09 +00:00
Fixed #17356 -- Allowed {% include %} to render compiled templates
Reviewed by Loic Bistuer and Tim Graham.
This commit is contained in:
committed by
Anssi Kääriäinen
parent
169637649b
commit
5cdacbda03
@@ -691,6 +691,12 @@ the variable ``template_name``::
|
||||
|
||||
{% include template_name %}
|
||||
|
||||
.. versionchanged:: 1.7
|
||||
|
||||
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.
|
||||
|
||||
An included template is rendered with the context of the template that's
|
||||
including it. This example produces the output ``"Hello, John"``:
|
||||
|
||||
|
||||
@@ -258,6 +258,11 @@ Templates
|
||||
* The :ttag:`widthratio` template tag now accepts an "as" parameter to capture
|
||||
the result in a variable.
|
||||
|
||||
* The :ttag:`include` template tag will now also accept anything with a
|
||||
``render()`` method (such as a ``Template``) as an argument. String
|
||||
arguments will be looked up using
|
||||
:func:`~django.template.loader.get_template` as always.
|
||||
|
||||
Backwards incompatible changes in 1.7
|
||||
=====================================
|
||||
|
||||
|
||||
Reference in New Issue
Block a user