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!

4

1 回答 1

1

老问题,但我有同样的问题。问题出在settings.py文件配置中。尝试在之后添加TEMPLATE_LOADERS

TEMPLATE_CONTEXT_PROCESSORS = ('django.core.context_processors.request',
                               'django.contrib.auth.context_processors.auth',
                               'django.core.context_processors.static',
                              )
于 2013-01-11T14:04:41.413 回答