mirror of
https://github.com/django/django.git
synced 2025-08-04 10:59:45 +00:00
Set context.template instead of context.engine while rendering.
This opens more possibilities, like accessing context.template.origin. It also follows the chain of objects instead of following a shortcut.
This commit is contained in:
parent
efb1f99f94
commit
1bfcc950ab
8 changed files with 53 additions and 48 deletions
|
@ -162,7 +162,7 @@ instance in the ``render()`` method of a template tag, you can use the current
|
|||
|
||||
You can write::
|
||||
|
||||
template = context.engine.get_template('included.html')
|
||||
template = context.template.engine.get_template('included.html')
|
||||
|
||||
This will load the template with the current engine without triggering the
|
||||
multiple template engines machinery, which is usually the desired behavior.
|
||||
|
@ -201,7 +201,7 @@ APIs. The multiple template engines machinery isn't involved here.
|
|||
Finally, if you have access to the current context, you can use the same trick
|
||||
as above::
|
||||
|
||||
template = context.engine.from_string(template_code)
|
||||
template = context.template.engine.from_string(template_code)
|
||||
|
||||
``Template()``
|
||||
==============
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue