On 3/13/07, Ivan Sagalaev <[EMAIL PROTECTED]> wrote:
> So for "object_list" and "object_detail" I propose this syntax:
>
>      {% obj_url "appname.ModelName" id %}
>      {% obj_list_url "appname.ModelName" %}
>
> Both GVs have their own tag that knows the actual name of a GV (like
> "django.views.generic.list_detail.object_list"). Though I like it this
> way it's not set in stone and may be some parameter would be better
> (like {% url "object_detail" "appname.ModelName" %}).

I'm a strong -1 on having generic-view-specific permalink functions
and template tags like this. This solution goes after the symptoms
rather than the fundamental problem, which is that the current reverse
URL implementation cannot handle multiple URL patterns for the same
view.

I've done some thinking on this, too, and I think the cleanest way to
solve it would be to introduce optional names for URL patterns.
Something like this:

    url(r'^objects/$', some_view, name='object_view'),
    url(r'^objects2/$', some_view, name='object_view2'),

This way, you could give an arbitrary name to a particular pattern, so
that you could target it via a reverse lookup. The Routes package does
something similar ("named routes"). Note that it would require URL
patterns to be function calls -- url() -- but that's probably a good
long-term switch, anyway, because it lets us do more interesting
things. We could likely keep it backwards compatible by changing the
patterns() function to convert any plain tuple into an object of the
type url() returns.

Adrian

-- 
Adrian Holovaty
holovaty.com | djangoproject.com

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To post to this group, send email to django-developers@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to