On Jul 1, 2009, at 9:56 PM, Nick Fishman wrote:

>
> Hey everyone,
>
> I'm working with Django's named URL patterns, and was wondering how to
> fetch the name of the URL pattern that triggered the view. For
> example, with the following urlpatterns
>
> urlpatterns = patterns('',
>    url(r'^archive/(\d{4})/$', archive, name="full-archive"),
>    url(r'^archive-summary/(\d{4})/$', archive, {'summary': True},
> "arch-summary"),
> )
>
> is there any way to fetch the name="full-archive" and
> name="arch-summary" parameter from inside the view?
>
> I found a thread that talks about this same issue
> (http://stackoverflow.com/questions/1042211/get-name-for-matched-url-pattern 
> ),
> but the solution requires duplicating the URL pattern name in a
> dictionary.
>
> Thanks,
>
> Nick


Can you get what you need within the view by using  
request.build_absolute_uri()?

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