Skip to content Skip to sidebar Skip to footer

Django: Context Processor Not Being Run On Login Page?

I have created a context processor which aims to pass a certain variable to any template that gets loaded. This is how I have defined my context processor: from django.conf import

Solution 1:

Context processors is not used if you doesn't call it.

The long path:

return render_to_response("my_app/my_template.html", {'some_var': 'foo'},
                           context_instance=RequestContext(request))

The short path:

from django.shortcuts import render

defsome_view(request):
   ...Do something....
   return render(request, "MyTemplate.html",{})

Post a Comment for "Django: Context Processor Not Being Run On Login Page?"