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
What does {{ name }} this mean in Django Templates? {{ name }} will be the output. It will be displayed as name in HTML. The name will be replaced with values of Python variable.
Context, but Django also comes with a subclass, django. template. RequestContext, that acts slightly differently. RequestContext adds a bunch of variables to your template context by default – things like the HttpRequest object or information about the currently logged-in user.
Whenever a request comes into Django, it is handled by middlewares. When the Django server starts, the first thing it loads after settings.py is middlewares. The Request is processed by various middlewares one at a time. So, from the above list, when the request comes it will be passed through the security middleware.
settings.py:
TEMPLATE_CONTEXT_PROCESSORS = ( # ... 'django.core.context_processors.request', # ... )
TEMPLATE_CONTEXT_PROCESSORS instead of TEMPLATE_PROCESSORS
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With