Re: #25582: Add a way to build URLs with query strings

2015-11-24 Thread Rob Hudson
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 temp

Re: #25582: Add a way to build URLs with query strings

2015-11-14 Thread Tino de Bruijn
Would it be an idea to have QueryDict accept a dictionary to construct it? Then you could use it’s urlencode method to create the querysting. Seems like a logical place to implement this to me. Tino > On 09 Nov 2015, at 14:30, Merijn Bertels wrote: > > I think would be a good thing if we crea

Re: #25582: Add a way to build URLs with query strings

2015-11-09 Thread Merijn Bertels
I think would be a good thing if we create a function to support this. But I don't think it should be build in the reverse function. Like to point out that the Admin ChangeList has a function on the class who does something like this: https://github.com/django/django/blob/master/django/contrib

Re: #25582: Add a way to build URLs with query strings

2015-10-26 Thread guettli
Up to now you can change only one field in your make_query() method. Flowing "think in sets" it would be nice to update N key-value pairs. Am Freitag, 23. Oktober 2015 17:18:38 UTC+2 schrieb Collin Anderson: > > If it helps, I have a similar need in the template. My case requires > adding, remov

Re: #25582: Add a way to build URLs with query strings

2015-10-23 Thread Tim Graham
On the ticket, Luke pointed out these libraries: 1) For Python code: urlobject ​​https://github.com/zacharyvoase/urlobject/ and furl ​​https://github.com/gruns/furl 2) For template code: django-spurl - ​​https://github.com/j4mie/django-spurl He doesn't see a need to include a subset of the funct

Re: #25582: Add a way to build URLs with query strings

2015-10-23 Thread Collin Anderson
If it helps, I have a similar need in the template. My case requires adding, removing, or replacing one of the arguments on the fly: In templates, I often need to change _one_ key of a GET request on the fly. My use case is a "filter by" sidebar on the same page as a "sort by" and "number per p

Re: #25582: Add a way to build URLs with query strings

2015-10-23 Thread 'Tom Evans' via Django developers (Contributions to Django itself)
On Fri, Oct 23, 2015 at 12:59 PM, guettli wrote: > API proposal: > > Add a new kwarg to reverse(): > >reverse(..., get=None) > > > Example: reverse('my_view_name', kwargs={'pk': '1'}, get=dict(param='value') Would 'get' be a dict or a querydict? (URL parameters can be repeated, dict keys cann

Re: #25582: Add a way to build URLs with query strings

2015-10-23 Thread Dheerendra Rathor
How about a wrapper over reverse? Modifying reverse will lead to multiple changes in core urlresolver. A class based urlresolver can be implemented which will call reverse internally. On Friday, 23 October 2015 17:29:25 UTC+5:30, guettli wrote: > > API proposal: > > Add a new kwarg to revers

Re: #25582: Add a way to build URLs with query strings

2015-10-23 Thread guettli
API proposal: Add a new kwarg to reverse(): reverse(..., get=None) Example: reverse('my_view_name', kwargs={'pk': '1'}, get=dict(param='value') result: /my-view/1?param=value Am Freitag, 23. Oktober 2015 13:43:18 UTC+2 schrieb Tim Graham: > > Can you make an API proposal? > > On Friday,

Re: #25582: Add a way to build URLs with query strings

2015-10-23 Thread Tim Graham
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?f