venkata subramanian wrote:
> Hi,
> I had a problem recently.
> To access the request object in all of my templates.
> The solution I got surprised me. It involved explicitly passing on
> the request object from the views.
> (Example, to pass a RequestContext object as a context_instance
> parameter in render_to_response method).
>
> It surprised me because since request object is available to every
> view, why should the request
> object not be accessible in all templates by default?
>
> I am just eager to understand this design decision.
>
> Thanks.
>
> >
>
>
You can do it
in settings.py add:
TEMPLATE_CONTEXT_PROCESSORS = (
'django.core.context_processors.auth',
'django.core.context_processors.request',
)
and in every view import:
from django.template import RequestContext
adn finally when you make a render to response:
return render_to_response ( "TEMPLATEFILE", {}, context_instance =
RequestContext ( request ), )
ARIEL ( 000PaRaDoX000 )
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
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
-~----------~----~----~----~------~----~------~--~---