2018-03-06 23:46:21 -05:00
|
|
|
from annoying.decorators import render_to
|
|
|
|
from django.shortcuts import redirect
|
|
|
|
from ..models import Entry
|
|
|
|
|
|
|
|
|
|
|
|
@render_to('entries/entry.html')
|
2018-03-07 21:49:02 -05:00
|
|
|
def entry(request, kind, id, slug=None):
|
2018-03-06 23:46:21 -05:00
|
|
|
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)
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@render_to('entries/entry_amp.html')
|
2018-03-07 21:49:02 -05:00
|
|
|
def entry_amp(request, kind, id, slug=None):
|
2018-03-06 23:46:21 -05:00
|
|
|
entry = Entry.objects.get(pk=id)
|
|
|
|
if request.path != entry.amp_url:
|
|
|
|
return redirect(entry.amp_url, permanent=True)
|
|
|
|
return {'entry': entry}
|