Hi Nenad,
you can wrap your meta-refresh line in another block and then delete
it's content in templates which shouldn't be refreshed.
# base_site.html
{% block extrahead %}
{% block extrahead-refresh %}
<meta http-equiv="refresh" content="60" />
{% endblock %}
{% endblock %}
# change_form.html -- deletes content of block extrahead-refresh
{% block extrahead-refresh %}{% endblock %}
Quote from django docs:
* More {% block %} tags in your base templates are better. Remember,
child templates don’t have to define all parent blocks, so you can fill
in reasonable defaults in a number of blocks, then only define the ones
you need later. It’s better to have more hooks than fewer hooks.
Cheers,
Tom
Dne Sat, 9 Mar 2013 01:41:35 -0800 (PST)
Nenad Cikic <[email protected]> napsal(a):
> Hello,
> I am using django admin for my project so I am not writing much templates
> by myself, therefore I am not very skilled with them, so excuse me if I ask
> dumb question.
> I have extended base_site.html to add browser refresh in block extrahead.
> I do not want however to do refresh while I am inserting data.
> In my change_form.html I have something as
> {% block extrahead %}{{ block.super }}
>
> What I would need is the possiblity to have some template variable that is
> True for base_site.html and that I set to False only in change_form.html,
> and then I could use that in base_site.html something as
>
> base_site.html
> {% block extrahead %}
> {% if do_refresh %}
> <meta http-equiv="refresh" content="60" />
> {% endif %}
> {% endblock %}
>
> I understand that the template is only for presentation and not logic, as
> found in docs, but this I do see as logic of presentation:)
> I am looking in docs but can not see anythign useful for my scenario, which
> should not be so uncommon.
>
> What's the proper way to solve this.
> Thanks
> Nenad
>
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.