On 29 sep, 23:16, bruno desthuilliers <[EMAIL PROTECTED]>
wrote:
Partly answering to myself:
(snip)
> After a couple more tests and investigations, it appears that the
> nested blocks have nothing to do with my problem. What really happens
> is that, given
>
> - a context updating tag
> - a base template base.html with a block defined in it,
> - and another template another.html extending base and filling the
> block
>
> if you call the context updating tag at the "top level" of
> another.html, the updated context is not accessible from within the
> block.
And after still more testing, it appears that the templatetag is
simply not called at all. Ok, this surely makes sense for content-
rendering templatetags - since this part of the template source file
will not be rendered at all. But this means that context-updating tags
cannot be called outside blocks (unless of course at the top-level of
the 'base' template).
Mmm...
(snip)
> # flat_base.html
> <html>
> <head><title>{{ yadda }}</title></head>
> <body>
> <h1>Flat Base Top</h1>
>
> <div id="flat">
> {% block flat %}
> <h2>Block flat</h2>
> {% endblock flat %}
> </div>
> </body>
> </html>
>
> # flat.html
> {% extends "flat_base.html" %}
> {% load my_tags %}
>
> {% set_context "42" as answer %}
>
> {% block flat %}
> {{ block.super }}
> Answer : {{ answer|default:"None" }}<br />
> {% set_context "42" as answer %}
> Answer : {{ answer|default:"None" }}<br />
>
> {% endblock flat %}
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" 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-users?hl=en
-~----------~----~----~----~------~----~------~--~---