diff options
author | luxagraf <sng@luxagraf.net> | 2016-11-16 08:37:40 -0500 |
---|---|---|
committer | luxagraf <sng@luxagraf.net> | 2016-11-16 08:37:40 -0500 |
commit | 702dc9deb63a15277ba3a3ee397933dbe7a6ffbc (patch) | |
tree | 000a8c9f72e8d97420473aca01d62ca422bdedc0 /app/jrnl | |
parent | b460162a8c744486857dae48c6afc1632c7115ba (diff) |
got rid of amp view and added date-based urls to allow for using the
same slug twice so long as it's in different months
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" |