Re: About multiple GET params persistance between requests

24 views
Skip to first unread message

felix

unread,
Aug 3, 2015, 11:44:15 AM8/3/15
to django...@googlegroups.com
El 03/08/15 09:42, durir...@gmail.com escribió:
I'm in a point of my app where I've two GET params, p and q (pagination and query search), and I think that the best method to remember the params value when you change page is to use a string to manually build up the params URL. Any ideas?

ListView might help or maybe its ancestor MultipleObjectMixin with its paginate_by attribute.

Ryan Nowakowski

unread,
Aug 3, 2015, 3:31:15 PM8/3/15
to django...@googlegroups.com
On Mon, Aug 03, 2015 at 11:49:09AM -0400, felix wrote:
> El 03/08/15 09:42, durir...@gmail.com escribió:
> >I'm in a point of my app where I've two GET params, *p* and *q*
> >(pagination and query search), and I think that the best method to
> >remember the params value when you change page is to use a string to
> >manually build up the params URL. Any ideas?
> >
> ListView might help or maybe its ancestor MultipleObjectMixin with its
> paginate_by attribute.

Or if you just want a good way to build up that query, I use QueryDict:

from django.http import QueryDict
qdict = QueryDict('', mutable=True)
qdict['p'] = my_page
qdict['q'] = my_query
my_new_url = "http://example.com/my-view?%s" % qdict.urlencode()
Reply all
Reply to author
Forward
0 new messages