djangosnippets.org: Latest snippets tagged with 'paginate_by'https://djangosnippets.org/tags/paginate_by/2011-01-19T11:24:25.612601-06:00Extend generic view object_list to support paginate_by via cookies
2011-01-19T11:24:25.612601-06:00kersurkhttps://djangosnippets.org/snippets/2329/<p>You can use this view to have a possibility to use ?paginate_by=x on your generic lists.
</p>
<p>Example usage in urls.py:
</p>
<p><code>url('^list/', object_list_with_paginate_by,
{'queryset': Invoice.objects.all(), 'template_name': 'invoices/list.html', 'paginate_by': 10},
'invoices.list')</code>
</p>
<p>10 is the default objects count per page.
</p>
<p>For the first time parameter paginate_by is set in URL, we have to …</p>
Freely redistributable