dif %}
> …stuff...
> {% endblock %}
>
>
> # child.html
> {% extends "parent.html" %}
>
> {% block someblock %}
> {% with True as cool_optional_feature_is_enabled %}
> {{ block.super }}
> {% endwith %}
> {% endblock %}
>
>
> The cool thing
%}
> …stuff…
> {% if cool_optional_feature_is_enabled %}
> …optional stuff...
> {% endif %}
> …stuff...
> {% endblock %}
>
>
> # child.html
> {% extends "parent.html" %}
>
> {% block someblock %}
> {% with True as cool_optional_feature_is_enabled %}
> {
> …stuff…
> {% if cool_optional_feature_is_enabled %}
> …optional stuff...
> {% endif %}
> …stuff...
> {% endblock %}
>
>
> # child.html
> {% extends "parent.html" %}
>
> {% block someblock %}
> {% with True as cool_optional_feature_
This sounds safe to me. After all, we pass context variables in from views
and expect them to be available within block.super code.
Perhaps some folks aren't sufficiently clear as to when stuff in a template
is evaluated.
So, I'd do it if I needed it.
On Tue, Sep 24, 2013 at 1:59
block someblock %}
{% with True as cool_optional_feature_is_enabled %}
{{ block.super }}
{% endwith %}
{% endblock %}
The cool thing is that this technique allows a child template to
essentially enable a feature in the parent template. The same technique can
also be used to disable a feature in the
I am am using with tag to transfer flags to block.super like this:
{% with something=1 %}
{{ block.super }}
{% endwith %}
Now if block.super rises an exception, for example NoReverseMatch,
instead of error page, the {{ block.super }} renders to an empty
string, the exception is
into your block
js while the html is included into your block content. You can put
includes into nested folders in your app or a separate includes folder
if you would like to keep them together. for instance
{% block js %}{{ block.super }}
{% if myapp.has_nav %}
{% include &q
ne. But what i
> want now (and i guess isnt possible and im just on the wrong way here
> ^^) is :
>
> -- menu.html --
> {% block extrahead %}
> {{ block.super }}
>
>
> {% endblock extrahead %}
>
> ...
>
>
> So the content of menu will be inserted at the
ere
^^) is :
-- menu.html --
{% block extrahead %}
{{ block.super }}
{% endblock extrahead %}
...
So the content of menu will be inserted at the include-tag and the
extra js should be inserted into the extrahead-block. I hope thats a
better example of what i want to do. Again, i wouldnt be suprised if
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
so
> I've switched to that instead of using safe.
>
> Here's my base.html now:
>
> {% autoescape off %}
> {% block breadcrumbs %}
> Home
> {% endblock %}
> {% endautoescape %}
>
> I guess a "DRY-alert" didn't go off in my head
Hi Michael,
> This should only be needed if you did not do what Malcolm called "Simple
> backwards compatibility", i.e. to set {% autoescape off %}.
>
> So, am I right that you didn't put such a {% autoescape off %} tag in your
> root template? Then you have to examine whether you use any html fr
Hi Josh,
On Wed, Nov 14, Josh wrote:
>
> Fixed it.
>
> New feature in django-dev is HTML escaping for any template tags (good
> against cross-site scripting problems).
>
> Had to apply the safe filter to any template tags I don't want auto-
> escaped.
Fixed it.
New feature in django-dev is HTML escaping for any template tags (good
against cross-site scripting problems).
Had to apply the safe filter to any template tags I don't want auto-
escaped.
OLD: {{ block.super|safe }}
NEW: {{ block.super|safe }}
Read more about it in django
block.super was working great before i did an svn up this morning..
All of my block.super template tags are returning the HTML character
codes instead of the actual HTML - so instead of getting proper HTML
links, i get the text of the HTML link.
Has anyone come across this? New bug?
- Josh
I think that you can only use {{block.super}}. May be you have to
change your template design
On Feb 12, 12:09 pm, "Rob Slotboom" <[EMAIL PROTECTED]> wrote:
> Sorry that isn't working (at least not in my template )
--~--~-~--~~~---~--~~
Y
Sorry that isn't working (at least not in my template )
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from t
On 1/29/07, Rob Slotboom <[EMAIL PROTECTED]> wrote:
...
>
> I tried
> {{ block.super }}
> {{ block.super.super }}
> {{ block.super.block.super }}
> But none of these are doing the right thing. Is there a way to call
> the parents parent blocks?
>
>
Perhaps bl
On my base template I have a block, say X
One level down there is a section template (extending base)
overwriting block X
Further down there are templates (extending section). On these
templates I want to be able to get the original value of X.
I tried
{{ block.super }}
{{ block.super.super
20 matches
Mail list logo