Re: Do I have to pass the httprequest object to render_to_response every time?

2009-10-22 Thread Bayuadji

IMHO Yes,
otherwise the context_processor variable won't be available in template

-djibon-

On Thu, Oct 22, 2009 at 11:43 AM, jul  wrote:
>
> But I still have to pass RequestContext(request) to render_to_response
> if I'm not using generic views, right?
>
> On Oct 21, 8:38 pm, Andrew Ingram  wrote:
>> jul wrote:
>> > hi,
>>
>> > in my base.html template I've got a header which needs httprequest
>> > (request.path, request.user.is_authenticated...).
>> > In all my views I'm passing the request object to render_to_response.
>> > Is there any better way to do that?
>>
>> > thanks
>> > jul
>>
>> Hi jul,
>>
>> There is a context processor that comes as part of django that gives you
>> access to the request object:
>>
>> http://docs.djangoproject.com/en/dev/ref/templates/api/#django-core-c...
>>
>> as long as you have it specified in your settings.py, it will
>> automatically become available if you use render_to_response
>>
>> Regards,
>> Andrew Ingram
> >
>



-- 
--
http://www.tumbletooth.org
my linkedin profile : http://www.linkedin.com/in/bayuadji
--

--~--~-~--~~~---~--~~
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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Do I have to pass the httprequest object to render_to_response every time?

2009-10-22 Thread jul

But I still have to pass RequestContext(request) to render_to_response
if I'm not using generic views, right?

On Oct 21, 8:38 pm, Andrew Ingram  wrote:
> jul wrote:
> > hi,
>
> > in my base.html template I've got a header which needs httprequest
> > (request.path, request.user.is_authenticated...).
> > In all my views I'm passing the request object to render_to_response.
> > Is there any better way to do that?
>
> > thanks
> > jul
>
> Hi jul,
>
> There is a context processor that comes as part of django that gives you
> access to the request object:
>
> http://docs.djangoproject.com/en/dev/ref/templates/api/#django-core-c...
>
> as long as you have it specified in your settings.py, it will
> automatically become available if you use render_to_response
>
> Regards,
> Andrew Ingram
--~--~-~--~~~---~--~~
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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Do I have to pass the httprequest object to render_to_response every time?

2009-10-21 Thread Andrew Ingram

jul wrote:
> hi,
>
> in my base.html template I've got a header which needs httprequest
> (request.path, request.user.is_authenticated...).
> In all my views I'm passing the request object to render_to_response.
> Is there any better way to do that?
>
> thanks
> jul

Hi jul,

There is a context processor that comes as part of django that gives you 
access to the request object:

http://docs.djangoproject.com/en/dev/ref/templates/api/#django-core-context-processors-request

as long as you have it specified in your settings.py, it will 
automatically become available if you use render_to_response

Regards,
Andrew Ingram

--~--~-~--~~~---~--~~
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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Do I have to pass the httprequest object to render_to_response every time?

2009-10-21 Thread jul

hi,

in my base.html template I've got a header which needs httprequest
(request.path, request.user.is_authenticated...).
In all my views I'm passing the request object to render_to_response.
Is there any better way to do that?

thanks
jul

--~--~-~--~~~---~--~~
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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---