Re: How to store position of current/active navigation entry
There is no usual way to do this because you can have anything behind menu item. So here is what I do in the same situations. Let say that we have some categories listed in your navi. Every category must have unique ID so in navi view pass some variable with that ID for example "foo = entry.pk"
Then in template you can do this
<li{% if foo == entry.id %} class="active"{% endif %}><a href="{{ entry.href }}">{{ entry.name }}</a></li>
hope it helps
On Thursday, August 1, 2013 3:30:23 PM UTC+2, DJ-Tom wrote:
Hi,--
I'm currently creating a web app with django that will have a side bar menu with several sub-sections.
I'm wondering if there is a "standard" way to store the "current" or "active" menu entry so I can highlite it in the menu area each time a request takes place.
Is it possible to attach arbitrary information to the current users session object?
thanks
thomas
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 django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home