Where can I put code that will get executed when page refreshes

9 views
Skip to first unread message

frocco

unread,
Jan 22, 2013, 11:34:13 AM1/22/13
to django...@googlegroups.com
I have a  index.html template that extends base.html
In Index I has:
{% block side_menu %}
    <h3>Content</h3>
{% endblock %}

I fill this block from a database table.
This only works if I click on the home link.
if I click any other link to view, the side-menu is not populated.

url(r'^$', 'ntw.views.index', name='home'), works
url(r'^staff/', 'staff.views.index'), does not work

ntw.views.py has the code to query the database

Pankaj Singh

unread,
Jan 23, 2013, 5:29:33 AM1/23/13
to django...@googlegroups.com
Hey,

You must be using a context variable to fill your `side_menu` block.

One reason for failure can be that, context variable is available in
template when `ntw.views.index` is called but not available when
'staff.views.index' is called.

--
Pankaj Singh
http://about.me/psjinx
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/django-users/-/tRmjXkGaeoEJ.
> To post to this group, send email to django...@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
Reply all
Reply to author
Forward
0 new messages