Tim Daniel schrieb: > I read something that it would be more > efficient to store only the query and doing pickle?? I don't know how > to do that, I've been looking in the docs and other posts but no clear > explanation. So what I really want to know: which is the best way of > handling this problem? I have my own paginator, too.
I use request.GET and create a new URL with the item 'page_number' changed. Here is a snippet. It disables the [next] link, if there is no next page. qs=dict(request.GET) def qs2url(qs): new={} for key, value in qs.items(): if isinstance(value, (list, tuple)): value=[v.encode('utf8') for v in value] elif isinstance(value, (int, long)): value=str(value) else: value=value.encode('utf8') new[key]=value return escape(django.http.urlencode(new, doseq=True)) if page.has_next(): qs['page_number']=page_number+1 next='<a href="./?%s">></a>' % qs2url(qs) qs['page_number']=paginator.num_pages last='<a href="./?%s">>></a>' % qs2url(qs) else: next='>' last='>>' if page.has_previous(): qs['page_number']=page_number-1 prev='<a href="./?%s"><</a>' % qs2url(qs) qs['page_number']=1 first='<a href="./?%s"><<</a>' % qs2url(qs) else: prev='<' first='<<' first=mark_safe(first) prev=mark_safe(prev) next=mark_safe(next) last=mark_safe(last) -- Thomas Guettler, http://www.thomas-guettler.de/ E-Mail: guettli (*) thomas-guettler + de --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---