summaryrefslogtreecommitdiff
path: root/app/lttr/views.py
diff options
context:
space:
mode:
Diffstat (limited to 'app/lttr/views.py')
-rw-r--r--app/lttr/views.py18
1 files changed, 7 insertions, 11 deletions
diff --git a/app/lttr/views.py b/app/lttr/views.py
index 79b8e72..e12d5a7 100644
--- a/app/lttr/views.py
+++ b/app/lttr/views.py
@@ -10,7 +10,7 @@ from django.shortcuts import get_object_or_404, redirect
from django.conf import settings
from django.urls import reverse, reverse_lazy
-from utils.views import PaginatedListView
+from utils.views import PaginatedListView, LuxDetailView
from smtplib import SMTPException
from .models import NewsletterMailing, Subscriber, Newsletter
@@ -19,22 +19,18 @@ from .forms import SubscribeRequestForm, UpdateForm
ACTIONS = ('subscribe', 'unsubscribe', 'update')
-class NewsletterMailingDetail(DetailView):
+class NewsletterMailingDetail(LuxDetailView):
model = NewsletterMailing
slug_field = "slug"
+ slug_url_kwarg = 'mailing'
def get_queryset(self):
queryset = super(NewsletterMailingDetail, self).get_queryset()
- return queryset.select_related('location').prefetch_related('field_notes').prefetch_related('books')
+ return queryset.filter(issue=self.kwargs['issue'])
- def get_object(self, queryset=None):
- obj = super(NewsletterMailingDetail, self).get_object(queryset=queryset)
- self.location = obj.location
- return obj
-
- def get_context_data(self, **kwargs):
- context = super(NewsletterMailingDetail, self).get_context_data(**kwargs)
- return context
+ def get_template_names(self):
+ obj = self.get_object()
+ return ["lttr/%s_detail.html" % obj.newsletter.slug, 'post_detail.html']
class NewsletterSubscribedView(TemplateView):