diff options
Diffstat (limited to 'app/jrnl')
-rw-r--r-- | app/jrnl/migrations/0015_entry_has_video.py | 21 | ||||
-rw-r--r-- | app/jrnl/views.py | 9 |
2 files changed, 30 insertions, 0 deletions
diff --git a/app/jrnl/migrations/0015_entry_has_video.py b/app/jrnl/migrations/0015_entry_has_video.py new file mode 100644 index 0000000..b643342 --- /dev/null +++ b/app/jrnl/migrations/0015_entry_has_video.py @@ -0,0 +1,21 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.10.3 on 2016-11-02 09:31 +from __future__ import unicode_literals + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + dependencies = [ + ('photos', '0016_auto_20161022_1411'), + ('jrnl', '0014_homepagecurrator'), + ] + + operations = [ + migrations.AddField( + model_name='entry', + name='has_video', + field=models.BooleanField(blank=True, default=False), + ), + ] 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" |