The others are correct. You can't put block tags inside an include.
It's pretty logical really. The block system cascades down templates
through the "extends" system. Includes are by nature outside that
track. They can be pulled into any template at any point in the
process. Block tags in an includ
Daishy,
I don't think you can do that with an include tag. You could do it by
defining a "base_with_menu.html" and having it extend "base.html" You
could make a menu block in base and override it in
base_with_menu.html.
Hope that helps,
Alex
On Feb 3, 3:28 am, Daishy wrote:
> Hi,
> Oh, sorry, b
Hi,
Oh, sorry, but i guess it really was a bit wague:
-- base.html --
{% block extrahead %}
{% endblock %}
{% include "menu.html" %}
sub_page would look like you wrote and that works fine. But what i
want now (and i guess isnt possible and im just on the wrong way here
^^) is :
-- menu.h
Daishy, it would help if you posted the template code you already
tried.
This is basically how you could do what you are describing:
base.html
{% block extrahead %}
{% endblock %}
sub_page.html
{% extends "base.html" %}
{% block extrahead %}
{{ block.super }}
Hi,
i'm pretty new to django and just stumbled upon a question i didnt
found a solution to, despite the good docs :).
I have a base-template which defines a block calles js and css. Now i
can extend that template and use these blocks and block.super, to add
javascript or css-files to those already
5 matches
Mail list logo