Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>When you construct a Paginator, you pass in the number of records per page. You need to get this value from the user, store it, and pass it in.</p> <p>For example, it could be a user setting -- if so, add it to your user setting Model, collect it in a form, store it, then get the Model from the db before creating the Paginator and pass it in.</p> <p>Or it could just be a session variable that is set from an element on the page -- again, put the element on the page, use it to set the session variable, and pass it into the Paginator object.</p> <p>Looks like it was covered in this question:</p> <p><a href="https://stackoverflow.com/questions/1729332/flexible-pagination-in-django">Flexible pagination in Django</a></p> <p>EDIT: Reading the comment.</p> <p>If you read the source, </p> <p><a href="http://code.google.com/p/django-pagination/source/browse/trunk/pagination/templatetags/pagination_tags.py" rel="nofollow noreferrer">http://code.google.com/p/django-pagination/source/browse/trunk/pagination/templatetags/pagination_tags.py</a></p> <p>The tag, autopaginate takes a number or a template variable.</p> <pre><code> if isinstance(paginate_by, int): self.paginate_by = paginate_by else: self.paginate_by = template.Variable(paginate_by) </code></pre> <p>So, try passing in a template variable in your view <code>'page_by':10</code> and the use <code>{% autopaginate list page_by %}</code> -- then you can set the <code>page_by</code> from the query string, db, or whatever you want.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload