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.
26 lines
675 B
26 lines
675 B
from annoying.decorators import render_to |
|
from django.shortcuts import redirect |
|
from .models import Entry |
|
|
|
|
|
@render_to('entries/index.html') |
|
def index(request, kind): |
|
entries = Entry.objects.filter(kind=kind.id) |
|
return { |
|
'entries': entries, |
|
'atom': 'entries:' + kind.atom, |
|
'rss': 'entries:' + kind.rss, |
|
'title': kind.plural, |
|
} |
|
|
|
|
|
@render_to('entries/entry.html') |
|
def entry(request, id, slug=None): |
|
entry = Entry.objects.get(pk=id) |
|
if request.path != entry.url: |
|
return redirect(entry.url, permanent=True) |
|
return { |
|
'entry': entry, |
|
'title': entry.title, |
|
'meta': entry.as_meta(request) |
|
}
|
|
|