djangosnippets.org: Latest snippets tagged with 'listview'https://djangosnippets.org/tags/listview/2018-01-25T00:20:22.201486-06:00Django Generic Paginator
2018-01-25T00:20:22.201486-06:00agusmakmunhttps://djangosnippets.org/snippets/10640/<p>Django Generic Paginator for <code>generic.ListView</code></p>
Freely redistributablePagination Alphabetically compatible with paginator_class
2012-04-19T10:35:38.112422-05:00vascophttps://djangosnippets.org/snippets/2732/<p>This is just a modified version of a <a href="http://djangosnippets.org/snippets/1364/">previous snippet</a> to make it work with unicode and with class-based ListView paginator_class</p>
<p>To use it put this in your urls.py:</p>
<p><code>from youapp.fileyouchose import NamePaginator</code>
<code>urlpatterns = patterns('',</code>
<code>url(r'^example/(?P<page>[0-9]+)/$', ListView.as_view(model=myModel,template_name="mytemplate.html",paginator_class=NamePaginator,paginate_by=25), name="url_name"),</code></p>
<p>And then in your template something like this would work:</p>
<pre><code>{% …</code></pre>
Freely redistributable