Switch home.urls and entries.urls over to modern path() definitions, with param conversion and such
This commit is contained in:
parent
0b43aad50e
commit
e9c46f23db
8 changed files with 60 additions and 31 deletions
|
@ -1,14 +1,12 @@
|
|||
from annoying.decorators import render_to
|
||||
from django.shortcuts import get_object_or_404
|
||||
from django.urls import reverse
|
||||
from .. import kinds
|
||||
from ..models import Entry, Cat
|
||||
from ..pagination import paginate
|
||||
|
||||
|
||||
@render_to('entries/index.html')
|
||||
def by_kind(request, kind, page):
|
||||
kind = kinds.from_plural[kind]
|
||||
def by_kind(request, kind, page=None):
|
||||
entries = Entry.objects.filter(kind=kind.id)
|
||||
entries = paginate(queryset=entries, reverse=kind.index_page, page=page)
|
||||
if hasattr(entries, 'content'):
|
||||
|
@ -23,7 +21,7 @@ def by_kind(request, kind, page):
|
|||
|
||||
|
||||
@render_to('entries/index.html')
|
||||
def by_cat(request, slug, page):
|
||||
def by_cat(request, slug, page=None):
|
||||
def url(page):
|
||||
kwargs = {'slug': slug}
|
||||
if page > 1:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue