Filtering results and pagination

Posted by alj on Stack Overflow See other posts from Stack Overflow or by alj
Published on 2010-04-27T20:51:24Z Indexed on 2010/04/27 20:53 UTC
Read the original article Hit count: 216

I have a template that shows a filter form and below it a list of the result records. I bind the form to the request so that the filter form sets itself to the options the user submitted when the results are returned.

I also use pagination. Using the code in the pagination documentation means that when the user clicks for the next page, the form data is lost.

What is the best way of dealing with pagination and filtering in this way?

  • Passing the querystring to the paginiation links.
  • Change the pagination links to form buttons and therefore submit the filter form at the same time, but this assumes that the user hasn't messed about with the filter options.
  • As above but with the original data as hidden fields.

ALJ

© Stack Overflow or respective owner

Related posts about django-forms

Related posts about django-templates