Le 13 mars 2012 à 18:40, Larry Martell a écrit :

> On Tue, Mar 13, 2012 at 11:26 AM, Xavier Ordoquy <xordo...@linovia.com> wrote:
>> Hi
>> 
>> Le 13 mars 2012 à 18:11, larry.mart...@gmail.com a écrit :
>> 
>>> From within a template can I find out the URL that caused the template
>>> to be invoked?
>> 
>> You usually should have the request object in your template. See 
>> https://docs.djangoproject.com/en/dev/ref/request-response/#django.http.HttpRequest.path
>>  to get the url.
>> 
> 
> But how do I access that in the template? I tried HttpRequest.path and
> {{ HttpRequest.path }} and neither gives me the URL.

{{ request.path }}
just make sure you have RequestContext if you use render_to_response.

Regards,
Xavier.

-- 
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.

Reply via email to