diff options
Diffstat (limited to 'app/jrnl/views.py')
-rw-r--r-- | app/jrnl/views.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/app/jrnl/views.py b/app/jrnl/views.py index b27ab96..5aa9d2b 100644 --- a/app/jrnl/views.py +++ b/app/jrnl/views.py @@ -2,6 +2,7 @@ from django.views.generic import ListView from django.views.generic.detail import DetailView from django.views.generic.dates import YearArchiveView, MonthArchiveView from django.contrib.syndication.views import Feed +from django.shortcuts import get_object_or_404 from django.conf import settings from utils.views import PaginatedListView @@ -71,6 +72,14 @@ class EntryDetailView(DetailView): template_name = "details/entry.html" slug_field = "slug" + def get_object(self): + obj = get_object_or_404( + self.model, + slug=self.kwargs['slug'], + pub_date__month=self.kwargs['month'], + pub_date__year=self.kwargs['year'] + ) + return obj class EntryDetailViewTXT(EntryDetailView): template_name = "details/entry.txt" |