summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/jrnl/views.py11
1 files changed, 9 insertions, 2 deletions
diff --git a/app/jrnl/views.py b/app/jrnl/views.py
index 1d4a965..1a29898 100644
--- a/app/jrnl/views.py
+++ b/app/jrnl/views.py
@@ -1,5 +1,6 @@
from django.views.generic import ListView
from django.views.generic.detail import DetailView
+from django.views.generic.dates import DateDetailView
from django.views.generic.dates import YearArchiveView, MonthArchiveView
from django.contrib.syndication.views import Feed
from django.shortcuts import get_object_or_404
@@ -71,8 +72,9 @@ class EntryMonthArchiveView(MonthArchiveView):
template_name = "archives/writing_date.html"
-class EntryDetailView(DetailView):
+class EntryDetailView(DateDetailView):
model = Entry
+ date_field = 'pub_date'
slug_field = "slug"
def get_queryset(self):
@@ -80,7 +82,12 @@ class EntryDetailView(DetailView):
return queryset.select_related('location').prefetch_related('field_notes').prefetch_related('books')
def get_object(self, queryset=None):
- obj = super(EntryDetailView, self).get_object(queryset=queryset)
+ obj = get_object_or_404(
+ self.model,
+ slug=self.kwargs['slug'],
+ pub_date__month=self.kwargs['month'],
+ pub_date__year=self.kwargs['year']
+ )
self.location = obj.location
return obj