Thursday, September 29, 2011

Re: Question about QuerySet and Pagination

On Thu, Sep 29, 2011 at 3:16 PM, Felix Wagner <hsaldinor@googlemail.com> wrote:
> Ok, so now i have:
> ..
>            <a href="?
> page={{ thin_client.previous_page_number }}"><img
> ...
> Now if i click next page I get an empty page because:
> http://127.0.0.1:8000/search/?page=2,
>
> I probably need a url entry and do i have to give the poaginator the
> query or do I have to save the query somewhere?
> Also thank you for your help.
>

If your view is based upon a query/parameters, its up to you to
persist that in the pagination URLs, so you will need to extract the
search parameters (request.META['QUERY_STRING']) and pass them through
to the template so you can include them in the pagination urls.

Be sure that you don't also include the 'page' parameter multiple
times on subsequent pages - eg ?q=cheese&page=2&page=3 is not ideal.

Cheers

Tom

--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

No comments:

Post a Comment