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/a/27641445/633961
It would be very nice if django could implement a short-cut which provides
this.
Example: reverse('my_view_name', kwargs={'pk': '1'}, get=dict(param='value')
result: /my-view/1?param=value
@register.simple_tag
def make_query(params, key=None, value=None):
from django.utils.http import urlencode
if key:
params = params.copy()
if value:
params[key] = value
else:
params.pop(key, None)
return '?' + urlencode(params, True) if params else '.'
--
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-develop...@googlegroups.com.
To post to this group, send email to django-d...@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/d13c725a-5dd4-4eda-9168-cc603fc7374e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
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-develop...@googlegroups.com.
To post to this group, send email to django-d...@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.