Web Images Maps News Groups Books Gmail more »
Recently Visited Groups | Help | Sign in
Google Groups Home
Message from discussion Reverse URL lookup implementation

View parsed - Show only message text

Received: by 10.11.53.63 with SMTP id b63mr2712242cwa;
        Thu, 06 Apr 2006 13:47:18 -0700 (PDT)
Return-Path: <ja...@jacobian.org>
Received: from eris.sunflowerbroadband.com (lists.sunflowerbroadband.com [24.124.4.61])
        by mx.googlegroups.com with ESMTP id v11si2900040cwb.2006.04.06.13.47.17;
        Thu, 06 Apr 2006 13:47:18 -0700 (PDT)
Received-SPF: neutral (googlegroups.com: 24.124.4.61 is neither permitted nor denied by best guess record for domain of ja...@jacobian.org)
Received: from [192.168.29.46] (gozur.sunflowerbroadband.com [24.124.4.220])
	by eris.sunflowerbroadband.com (8.13.1/8.13.1) with ESMTP id k36KlGJr016861
	for <django-developers@googlegroups.com>; Thu, 6 Apr 2006 15:47:16 -0500
Mime-Version: 1.0 (Apple Message framework v749.3)
In-Reply-To: <6464bab0604061324x7ca66a0foa9557418a638ab95@mail.gmail.com>
References: <6464bab0604061324x7ca66a0foa9557418a638ab95@mail.gmail.com>
Content-Type: text/plain; charset=WINDOWS-1252; delsp=yes; format=flowed
Message-Id: <8CA63CD1-2C6E-46B5-AE25-CB6F1FB31FB8@jacobian.org>
Content-Transfer-Encoding: quoted-printable
From: Jacob Kaplan-Moss <ja...@jacobian.org>
Subject: Re: Reverse URL lookup implementation
Date: Thu, 6 Apr 2006 15:47:16 -0500
To: django-developers@googlegroups.com
X-Mailer: Apple Mail (2.749.3)

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=3D'il' name=3D'adrian' %}

One thing we could do -- to make this even easier -- would be to grab =20=

data from an object passed into the {% link %} tag.  So in your =20
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=3Dperson.state =
name=3Dperson.name %}

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

Jacob=

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