At Mozilla we've used a jinja2 template filter called 'urlparams' for quite some time. You can see the code in jingo here: https://github.com/jbalogh/jingo/blob/master/jingo/helpers.py#L116
In Python: urlparams(reverse('translate', kwargs={'slug': document.slug}), to_locale=locale) In Jinja2 templates (but the idea would be similar in Django): <a href="{{ url('translate', slug=document.slug)|urlparams(to_locale=locale) }} The nice thing about this is if a URL already have query string params, `urlparams` knows how to deal with this and it urlencodes all the variables provided. Regardless of the API I would be pleased if something like this shipped standard with Django. -Rob On Fri, Oct 23, 2015 at 4:43 AM, Tim Graham <timogra...@gmail.com> wrote: > Can you make an API proposal? > > On Friday, October 23, 2015 at 3:41:42 AM UTC-4, guettli wrote: >> >> From https://code.djangoproject.com/ticket/25582 >> >> {{{ >> >> It is a common question on stackoverflow and other places: >> >> How to reverse() to url including GET parameters? Example: >> .../myview?foo=bar >> >> >> http://stackoverflow.com/questions/9585491/how-do-i-pass-get-parameters-using-django-urlresolvers-reverse >> >> http://stackoverflow.com/a/27641445/633961 >> >> It would be very nice if django could implement a short-cut which provides >> this. >> It would be useful for python code and template, too. >> }}} >> >> {{{ >> If we do add it, it likely needs a discussion on the >> DevelopersMailingList >> <https://code.djangoproject.com/wiki/DevelopersMailingList> to figure >> out what the API should look like. See also #10941 >> <https://code.djangoproject.com/ticket/10941> which asks for a template >> tag for creating query strings in templates. >> }}} >> >> What do you think? >> >> >> >> -- > You received this message because you are subscribed to the Google Groups > "Django developers (Contributions to Django itself)" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to django-developers+unsubscr...@googlegroups.com. > To post to this group, send email to django-developers@googlegroups.com. > Visit this group at http://groups.google.com/group/django-developers. > To view this discussion on the web visit > https://groups.google.com/d/msgid/django-developers/0f8dbd9f-b42d-4d17-806b-d965c0999b85%40googlegroups.com > <https://groups.google.com/d/msgid/django-developers/0f8dbd9f-b42d-4d17-806b-d965c0999b85%40googlegroups.com?utm_medium=email&utm_source=footer> > . > > For more options, visit https://groups.google.com/d/optout. > -- -Rob -- You received this message because you are subscribed to the Google Groups "Django developers (Contributions to Django itself)" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-developers+unsubscr...@googlegroups.com. To post to this group, send email to django-developers@googlegroups.com. Visit this group at http://groups.google.com/group/django-developers. To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/CAK2QP5bwU3s_1uzGMiwmu%2BP_u7SP5eF0zq3-E8k1sUj-TD2E7A%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.