a Django-based indieweb.org site https://00dani.me/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

36 lines
972 B

from annoying.decorators import render_to
from django.shortcuts import get_object_or_404
from django.urls import reverse
from ..models import Entry, Cat
from ..pagination import paginate
def by_kind(request, kind, page=None):
entries = Entry.objects.filter(kind=kind.id)
entries = paginate(queryset=entries, reverse=kind.index_page, page=page)
return {
'entries': entries,
'atom': kind.atom,
'rss': kind.rss,
'title': kind.plural,
def by_cat(request, slug, page=None):
def url(page):
kwargs = {'slug': slug}
if page > 1:
kwargs['page'] = page
return reverse('entries:cat', kwargs=kwargs)
cat = get_object_or_404(Cat, slug=slug)
entries = cat.entries.all()
entries = paginate(queryset=entries, reverse=url, page=page)
return {
'entries': entries,
'title': '#' + cat.name,