Hi,
I found the answer.
Instead of:
from django.shortcuts import render_to_response
def index(request):
return render_to_response('index.html')
I used:
from django.shortcuts import render_to_response
from django.template.context import RequestContext
def index(request):
return render_to_response('index.html',
context_instance =
RequestContext(request))
I found the hint here:
http://groups.goo
gle.com/group/django-users/browse_thread/thread/928186bf11dd
58c6/fcb4740e86d287c7?lnk=gst&q=requestcontext&rnum=
1#fcb4740e86d287c7
Regards,
Ray
Rares Vernica wrote:
> Hi,
>
> I written my own views. How can I pass a RequestContext
objects, instead
> of a plain Context object, from my view to my template?
>
> Thanks a lot,
> Ray
>
> Ian Clelland wrote:
>> On 7/24/06, Rares Vernica <rvernica gmail.com> wrote:
>>> The goal is to have request.META.PATH_INFO in
templates.
>>>
>>> The problem is that TEMPLATE_CONTEXT_PROCESSORS
does not seem to make
>>> any difference. request is still not accessible
from template. Even is
>>> I
>>> set the variable to () nothing happens.
>> As far as I know, the TEMPLATE_CONTEXT_PROCESSORS
setting only affects
>> templates which have a RequestContext object passed
to them by the
>> view, and not a plain Context object.
>>
>> The Django generic views all use RequestContext
objects, but if you've
>> written your own views, then you may be using plain
Context objects,
>> and your context processors won't be executed at
all.
>>
>
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
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-unsubscribe googlegroups.com
For more options, visit this group at http://gr
oups.google.com/group/django-users
-~----------~----~----~----~------~----~------~--~---
|