#15180: reverse doesn't check default_args
----------------------------------+-----------------------------------------
Reporter: olaf | Owner: nobody
Status: new | Milestone: 1.3
Component: Core framework | Version: 1.3-beta
Keywords: resolve default_args | Stage: Unreviewed
Has_patch: 1 |
----------------------------------+-----------------------------------------
Lets say we have the following urls:
{{{
(r'^photos/?$', 'views.photo_index', {'lang':'en'}, "photo_index"),
(r'^fotos/?$', 'views.photo_index', {'lang':'de'}, "photo_index"),
(r'^photo/(?P<photo_id>[\d]+)$', 'views.photo', {"lang":"en"}
,"photo"),
(r'^foto/(?P<photo_id>[\d]+)$', 'views.photo', {"lang":"de"}
,"photo"),
}}}
When I want to get the specific URL for a German visitor I wan't to just
to get the reverse for photo an add a keyword argument {'lang':'de'}. It
is very much writing to write for each language a different wrapper
function. You also would need to write a bunch of if-else statements to
select the correct one.
I saw that also some else expected this and asked a question at
stackoverflow about this, but he got only workaround as answers. I added a
few lines to correct behavior, and I hope this is useful for someone. I am
not sure, if I broke something so it would be nice someone else could test
this code also.
--
Ticket URL: <http://code.djangoproject.com/ticket/15180>
Django <http://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en.