Web Images Maps News Groups Books Gmail more »
Recently Visited Groups | Help | Sign in
Google Groups Home
Message from discussion Reverse URL lookup implementation
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
 
Jacob Kaplan-Moss  
View profile  
 More options Apr 7 2006, 8:47 am
From: Jacob Kaplan-Moss <ja...@jacobian.org>
Date: Thu, 6 Apr 2006 15:47:16 -0500
Local: Fri, Apr 7 2006 8:47 am
Subject: Re: Reverse URL lookup implementation
I just had another thought on this:

On Apr 6, 2006, at 3:24 PM, Adrian Holovaty wrote:

> Ideally there'd be a template-tag interface to this. Something like:

>     {% link 'path.to.month_view' 2005 'apr' %}
>     {% link 'path.to.person_view' state='il' name='adrian' %}

One thing we could do -- to make this even easier -- would be to grab  
data from an object passed into the {% link %} tag.  So in your  
example urlconf::

        (r'^people/(?P<state>\w\w)/(?P<name>\w+)/$', 'path.to.person_view'),

If a Person object had ``state`` and ``name`` attributes, you could do::

        {% link path.to.person_view person %}

(where ``some_person`` is an object in the context) as a shortcut to::

        {% link path.to.person_view state=person.state name=person.name %}

That way if you set up your URLconfs in a logical manner -- I'd bet  
90% of my urlconfs already work this way -- the shortcut version  
would Just Work™.

Jacob


    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