Login

Tag "static-class"

Snippet List

Search results pagination

**Problem**: You search by firing POST and paginate by firing GET, so search results disappear on GET. I want to preserve searching results, so user can paginate them. First I try to use some static class to keep search results, but this solution has bug (thanks to svetlyak). In multiuser environment other user searching got results from previous one. No @cache_control(private=True) helps so I decided to change searching schema by using GET in the first place and to supply query string on each 'paging' request. Also added some memory cache that expires after 5 min **In template** Please append query to each paging link: <a href="?page={{ page_number }} &amp;search_query={{ query|urlencode }}"> {{ page_number }}</a> This snippet should keep search results on pagination in multiuser environment.

  • search
  • pagination
  • static-class
Read More

1 snippet posted so far.