#7324: {{ block.super }} doesn't work with nested {% block %} statements
--------------------------------------+-------------------------------------
Reporter: jeverling | Owner: nobody
Status: closed | Milestone:
Component: Template system | Version: SVN
Resolution: invalid | Keywords: block.super template
Stage: Unreviewed | Has_patch: 0
Needs_docs: 0 | Needs_tests: 0
Needs_better_patch: 0 |
--------------------------------------+-------------------------------------
Changes (by kmtracey):
* status: reopened => closed
* resolution: => invalid
Comment:
You might want to try posting a question about what you are trying to do
and what is not working on django-users, not here. Based on your sample
project I can't tell if you have over-simplified to the point where things
are broken or if you have a fundamental misunderstanding of how template
inheritance works.
`{{ block.super }}` provides content for the block from the parent
template, which implies the current template is a child template, which
implies the first thing in the template containing `{{ block.super }}` is
an `{% extends %}` tag. Yet you do not have an extends tag in either of
your template files. You have also given them both the same name, which
makes me think you think that their parent-child relationship will be
intuited as a result of the order in which they are found based on how you
have listed the containing directories in the settings.py TEMPLATE_DIRS.
Nothing like that is done to figure out template inheritance; the parent-
child relationship is determined by the use of `{% extends %}` tags.
So what you describe seeing, that is no content from the
templates/test.html {% submain %} block being "inherited" when templates-
top/test.html is rendered (since that is the one that will be found, as
templates-top is first in the TEMPLATE_DIRS listing), is correct.
templates/test.html is not a child template and therefore has no parent
block to display for the sumbain block's content.
--
Ticket URL: <http://code.djangoproject.com/ticket/7324#comment:4>
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
-~----------~----~----~----~------~----~------~--~---