summaryrefslogtreecommitdiff
path: root/app/lttr/views.py
diff options
context:
space:
mode:
authorluxagraf <sng@luxagraf.net>2020-08-03 18:38:32 -0400
committerluxagraf <sng@luxagraf.net>2020-08-03 18:38:32 -0400
commiteea8117ac3b58d8ac9eb1c9f94d27ac28fc67008 (patch)
tree0b0e9e178d6fd7242f5c95b7aa071a3e127f109d /app/lttr/views.py
parentb8d217c6781d713fb6fd1199cbdda84017a95c8d (diff)
added all lttr updates to backup
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):