django request in template

Attila picture Attila · Mar 31, 2009 · Viewed 37.1k times · Source

I've enabled the django request processor

TEMPLATE_PROCESSORS = (
"django.core.context_processors.auth",
"django.core.context_processors.debug",
"django.core.context_processors.i18n",
"django.core.context_processors.media",
"django.core.context_processors.request",
)

Still i don't have to request variable available in templates. I've to manually pass it. Using django 1.0.2 Everywhere on web it seems it's only about enabled request processor..

Also i am using RequestContext as :

 return render_to_response(
    'profile.html',
    {
        'persons':Person.objects.all(),
        'person':Person.objects.get(id=id),
         'request':request,
    },
    context_instance=RequestContext(request)
)

no luck

ohh darn the new name for that is TEMPLATE_CONTEXT_PROCESSORS

Answer

Dingo picture Dingo · Apr 2, 2010

settings.py:

TEMPLATE_CONTEXT_PROCESSORS = (
  # ...
  'django.core.context_processors.request',
  # ...
)