Tuesday, March 13, 2012

Re: Getting URL from within a template

On Tue, Mar 13, 2012 at 11:58 AM, Xavier Ordoquy <xordoquy@linovia.com> wrote:
>
> Le 13 mars 2012 à 18:40, Larry Martell a écrit :
>
>> On Tue, Mar 13, 2012 at 11:26 AM, Xavier Ordoquy <xordoquy@linovia.com> wrote:
>>> Hi
>>>
>>> Le 13 mars 2012 à 18:11, Larry.Martell@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.

This is displaying a path, but not the URL I need. It gives
/report//EventsTable/ when the URL that's clicked on is:

http://127.0.0.1/report/EventsTable/?date_time=3y&submit_preview=Generate+Report&event_type=RecipeCreated&_filterValue=dev

I'm after all the arguments. Is there a way to get them?

--
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://groups.google.com/group/django-users?hl=en.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate