Hi, strange that nobody answered yet since I guess that almost everybody encountered the same question already.
I personally did it via a custom template tag which puts out active if the current URL matches the URL pattern for a view. Cheers Ivo On Jan 9, 2012, at 7:27 , Victor Hooi wrote: > hi, > > I have a project where I'm using Bootstrap (www.github.com/twitter/bootstrap) > with Django. > > I need to add a CSS class ("active") to highlight the active navigation link. > > Anyhow, I did some Googling: > > http://www.turnkeylinux.org/blog/django-navbar > http://ilostmynotes.blogspot.com/2010/03/django-current-active-page-highlighting.html > http://gnuvince.wordpress.com/2007/09/14/a-django-template-tag-for-the-current-active-page/ > http://stackoverflow.com/questions/340888/navigation-in-django > http://djangosnippets.org/snippets/1726/ > http://stackoverflow.com/questions/7665514/django-highlight-navigation-based-on-current-page > > The approach in the above seems to be to either use custom template tag, > middleware or JS-hackery. > > Is there a current consensus in the Django community in terms of what is the > "correct" approach for this? > > Is there a reason something like this isn't part of Django core, or an > in-built templatetag? > > Cheers, > Victor > > -- > 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/-/Xx5Rk_rBuxIJ. > To post to this group, send email to django-users@googlegroups.com. > To unsubscribe from this group, send email to > django-users+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. -- 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 this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.