Hi, I am trying to follow the DRY principle. For the navigation of my site I want to have a single template. My problem is that I need a way to change the class of the nav links depending on what page is currently being visited.
I want to try and do something of this sort: In my template do a ifequal current path to the path the nav links to than this will have the class of nav_here. All the other nav links will have a class of nav_regular. (The specific names of these classes doesn't matter.) On the django IRC channel someone suggested that I use a Context Processor to do this. I am not completely sure how Context Processors work but I tried anyways. In my settings.py I have: #Context Processors TEMPLATE_CONTEXT_PROCESSORS = ( 'binarymanipulations.context_processor', ) In the directory binarymanipulations I have a context_processor.py file with: #Context Processors should live here def CurrentPath(request): return {'current_path': request.path} My views.py is: # Create your views here. from django.shortcuts import HttpResponse from binarymanipulations.blog.models import Entry from django.template import Context, loader, Template from binarymanipulations.context_processor import CurrentPath def index(request): entries = Entry.objects.all().order_by('-pub_date') t = loader.get_template('blog/blog_list.html') c = Context({ 'posts' : entries }) return HttpResponse(t.render(c)) I don't know how to pass the context processor with HttpResponse so my template can do the ifequal. If someone can send me in the right direction it would be glorious. Evan --~--~---------~--~----~------------~-------~--~----~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---