1

I am trying to set a base django template whose navigation elements will highlight when they are active. I have tried the following posts to create a templatetag to append an active value to the markup:

Blog Post

110j's answer to this Stack Overflow Question (not the accepted answer)

Both are suggesting using a templatetag to check if user is on selected page, then use that to add an active value to the navigation in the template. However, I get an AttributeError saying that: 'str' object has no attribute 'path'. After searching, I cannot figure out how to remedy this problem..

How do I achieve the most de-coupled method of highlighting active navigation on Django 1.4.2 + python 2.7? Thank you very much for your input!

Community
  • 1
  • 1
Nick B
  • 9,267
  • 17
  • 64
  • 105

1 Answers1

1

Old question, but I had the same problem. The problem is in the settings.py file configuration. Try adding this after TEMPLATE_LOADERS:

TEMPLATE_CONTEXT_PROCESSORS = ('django.core.context_processors.request',
                               'django.contrib.auth.context_processors.auth',
                               'django.core.context_processors.static',
                              )
Aylen
  • 3,524
  • 26
  • 36