summaryrefslogtreecommitdiff
path: root/app/posts
diff options
context:
space:
mode:
authorluxagraf <sng@luxagraf>2021-01-15 16:36:00 -0500
committerluxagraf <sng@luxagraf>2021-01-15 16:36:00 -0500
commit776712e1288138f546d105ab621523a2c632638a (patch)
tree8215fb8e6d024f6f1b1b92bf962334ea61753fd0 /app/posts
parent47b79fd9d4329e73cef7929ed8f64d9eeb287ae5 (diff)
proj: updated several views to use utils.LuxDetailView
This allows for a single breadcrumbs template, consolidating code
Diffstat (limited to 'app/posts')
-rw-r--r--app/posts/views/guide_views.py7
-rw-r--r--app/posts/views/src_views.py4
2 files changed, 7 insertions, 4 deletions
diff --git a/app/posts/views/guide_views.py b/app/posts/views/guide_views.py
index d9503db..5b15af1 100644
--- a/app/posts/views/guide_views.py
+++ b/app/posts/views/guide_views.py
@@ -21,22 +21,25 @@ class GuideListView(PaginatedListView):
queryset = super(GuideListView, self).get_queryset()
return queryset.filter(status__exact=1).filter(post_type__in=[PostType.REVIEW,PostType.FIELD_TEST]).order_by('-pub_date').prefetch_related('location').prefetch_related('featured_image')
-class GuideTopicListView(GuideListView):
+
+class GuideTopicListView(PaginatedListView):
"""
Return a list of Posts by topic in reverse chronological order
"""
+ model = Post
template_name = "posts/guide_by_topic.html"
def get_queryset(self):
queryset = super(GuideTopicListView, self).get_queryset()
topic = Category.objects.get(slug=self.kwargs['topic'])
- return queryset.filter(status__exact=1).filter(topics__slug=topic).order_by('-pub_date').prefetch_related('featured_image')
+ return queryset.filter(status__exact=1).filter(topics__slug=topic.slug).order_by('-pub_date').prefetch_related('featured_image')
def get_context_data(self, **kwargs):
context = super(GuideTopicListView, self).get_context_data(**kwargs)
context['topic'] = Category.objects.get(slug=self.kwargs['topic'])
return context
+
class ReviewsListView(GuideListView):
template_name = "posts/post.html"
diff --git a/app/posts/views/src_views.py b/app/posts/views/src_views.py
index 90c672c..c56b723 100644
--- a/app/posts/views/src_views.py
+++ b/app/posts/views/src_views.py
@@ -6,7 +6,7 @@ from django.urls import reverse
from django.conf import settings
#from paypal.standard.forms import PayPalPaymentsForm
-from utils.views import PaginatedListView
+from utils.views import PaginatedListView, LuxDetailView
from ..models import Post, PostType
from taxonomy.models import Category
@@ -27,7 +27,7 @@ class SrcListView(PaginatedListView):
return context
-class SrcDetailView(DetailView):
+class SrcDetailView(LuxDetailView):
model = Post
slug_field = "slug"
template_name="posts/src_detail.html"