Gmail Calendar Documents Reader Web more »
Recently Visited Groups | Help | Sign in
Google Groups Home
Message from discussion Getting the name of a matched URL pattern
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Nick Fishman  
View profile  
 More options Jul 1, 9:56 pm
From: Nick Fishman <bsdlogi...@bsdlogical.com>
Date: Wed, 1 Jul 2009 21:56:59 -0400
Local: Wed, Jul 1 2009 9:56 pm
Subject: Getting the name of a matched URL pattern
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-p...),
but the solution requires duplicating the URL pattern name in a
dictionary.

Thanks,

Nick


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2009 Google