Switch from custom pagination to django.core.paginator, since it can do things like counts and 'is there a next page' more easily

This commit is contained in:
Danielle McLean 2017-12-13 09:56:18 +11:00
parent 2d2159ee58
commit 2a65644813
Signed by: 00dani
GPG key ID: 5A5D2D1AFF12EEC5
5 changed files with 26 additions and 38 deletions

View file

@ -11,14 +11,14 @@ def prefix(route):
return app_name + ':' + route
before = '(?:/before/(?P<before>\d+))?'
page = '(?:/page/(?P<page>\d+))?'
slug = r'/(?P<slug>[^/]+)'
app_name = 'entries'
urlpatterns = [
url('^atom$', feeds.AtomHomeEntries(), name='atom'),
url('^rss$', feeds.RssHomeEntries(), name='rss'),
url(to_pat('cats', slug, before), views.cat, name='cat'),
url(to_pat('cats', slug, page), views.cat, name='cat'),
]
crumbs.add(prefix('cat'), parent='home:index')
@ -28,7 +28,7 @@ for k in kinds.all:
kind = k.plural
id = r'/(?P<id>\d+)'
urlpatterns += (
url(to_pat(kind, before), views.index, name=k.index, kwargs={'kind': k}),
url(to_pat(kind, page), views.index, name=k.index, kwargs={'kind': k}),
url(to_pat(kind, '/atom'), feeds.AtomByKind(k), name=k.atom),
url(to_pat(kind, '/rss'), feeds.RssByKind(k), name=k.rss),
url(to_pat(kind, id, slug), views.entry, name=k.entry),