Opened 10 years ago
Last modified 10 years ago
#24425 closed Bug
Cross Backend template includes are not supported — at Version 1
Reported by: | Paul Hallett | Owned by: | nobody |
---|---|---|---|
Component: | Template system | Version: | 1.8beta1 |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description (last modified by )
Attempting to render Jinja templates with an include tag in a Django template results in the Django template backend parsing the jinja template.
For example:
templates/django.html:
Django Template! {% include 'include.jinja' %}
jinja2/include.jinja:
Jinja Template! {% set jinja = 1 %}
Will cause a template rendering error as set
is not a valid tag in Django templates.
This used to work fine as the IncludeNode
that powers the include tag would search using all configured loaders but since 1.8 it has changed to maintain the current engine context.
This seems like an obvious behaviour to want and we've relied on it heavily while porting our templates from Django to Jinja2 but this is now blocked by this change in 1.8.