#12008: included templates' blocks do not get processed as if they were from the
context of the including page
--------------------------------+-------------------------------------------
Reporter: [email protected] | Owner: nobody
Status: new | Milestone:
Component: Template system | Version: SVN
Keywords: include block | Stage: Unreviewed
Has_patch: 0 |
--------------------------------+-------------------------------------------
Consider the following example:
A.html:
{{{
{% block B %}{% include 'B.html' %}{% endblock %}
}}}
B.html:
{{{
{% block test %}this is a test default from B{% endblock %}
}}}
C.html:
{{{
{% extends 'A.html' %}
{% block test %}this is the test block from C{% endblock %}
}}}
This results in the "test" block being the default from the B template, as
opposed to getting overriden with the test block that's defined in C.
However, the following works:
A.html:
{{{
{% block test %}this is a test default from B{% endblock %}
}}}
C.html:
{{{
{% extends 'A.html' %}
{% block test %}this is the test block from C{% endblock %}
}}}
In this case the test block from C is correctly used.
The documentation states:
{{{
If an included template contains any template code — such as tags or
variables — then it will get evaluated with the context of the template
that’s including it.
}}}
If this were true I believe the top example should be valid.
--
Ticket URL: <http://code.djangoproject.com/ticket/12008>
Django <http://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---