On Wed, 2009-06-03 at 02:56 -0700, janedenone wrote:
> Hi,
> 
> is it possible to use alternating url patterns without confusing the
> reverse lookup mechanism?
> 
> I'd like to do something like
> 
> (r'^(authors|autoren)/(?P<author_id>[_a-z]+)$', 'author_detail'),
> 
> Kind regards,
> Jan

Define two separate URLs, and name them:
(r'^authors/(?P<author_id>[_a-z]+)$', 'author_detail', name='author_detail),
(r'^autoren/(?P<author_id>[_a-z]+)$', 'author_detail', name='autoren_detail),

Use the name in calls to reverse() or {% url %}. If you need to
distinguish between the two urls, pass a different default parameter to
each of them. See
http://docs.djangoproject.com/en/dev/topics/http/urls/#passing-extra-options-to-view-functions


Tom


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