diff options
author | luxagraf <sng@luxagraf.net> | 2024-03-06 11:46:03 -0600 |
---|---|---|
committer | luxagraf <sng@luxagraf.net> | 2024-03-06 11:46:03 -0600 |
commit | e8b218274167346b942927ee146d096d48dfebf3 (patch) | |
tree | c51b95d5e0223d47ed3b613c162dcb6af2c2771e /app/posts/views | |
parent | 89e3735883c03239270d33a3dc841a43f789f17e (diff) |
range: added new paths for essays
Diffstat (limited to 'app/posts/views')
-rw-r--r-- | app/posts/views/craft_views.py | 2 | ||||
-rw-r--r-- | app/posts/views/essay_views.py | 23 | ||||
-rw-r--r-- | app/posts/views/range_views.py | 2 |
3 files changed, 24 insertions, 3 deletions
diff --git a/app/posts/views/craft_views.py b/app/posts/views/craft_views.py index da5f2b1..409e393 100644 --- a/app/posts/views/craft_views.py +++ b/app/posts/views/craft_views.py @@ -17,7 +17,7 @@ class CraftListView(PaginatedListView): def get_queryset(self): queryset = super(CraftListView, self).get_queryset() - return queryset.filter(site__domain='luxagraf.net').filter(post_type__in=[PostType.HOWTO]).filter(status__exact=1).order_by('-pub_date').prefetch_related('location').prefetch_related('featured_image') + return queryset.filter(site__domain='luxagraf.net').filter(post_type__in=[PostType.CRAFT]).filter(status__exact=1).order_by('-pub_date').prefetch_related('location').prefetch_related('featured_image') def get_context_data(self, **kwargs): ''' diff --git a/app/posts/views/essay_views.py b/app/posts/views/essay_views.py index 02a1087..3c28834 100644 --- a/app/posts/views/essay_views.py +++ b/app/posts/views/essay_views.py @@ -7,7 +7,7 @@ from django.conf import settings from utils.views import PaginatedListView, LuxDetailView -from ..models import Post, PostType +from ..models import Post, PostType, PostTopic from taxonomy.models import Category @@ -29,6 +29,27 @@ class EssayListView(PaginatedListView): return context +class EssayCategoryList(PaginatedListView): + model = Post + template_name = "posts/essay_list.html" + + def get_queryset(self): + queryset = super(EssayCategoryList, self).get_queryset() + for t in PostTopic: + if t.label == self.kwargs['topic']: + topic = t + return queryset.filter(site__domain='luxagraf.net').filter(post_type__in=[PostType.ESSAY],post_topic=topic).filter(status__exact=1).order_by('-pub_date').prefetch_related('location').prefetch_related('featured_image') + + def get_context_data(self, **kwargs): + ''' + override for custom breadcrumb path + ''' + # Call the base implementation first to get a context + context = super(EssayCategoryList, self).get_context_data(**kwargs) + context['breadcrumbs'] = ('Essay',) + return context + + class EssayDetailView(LuxDetailView): model = Post slug_field = "slug" diff --git a/app/posts/views/range_views.py b/app/posts/views/range_views.py index f196e5e..dc09cee 100644 --- a/app/posts/views/range_views.py +++ b/app/posts/views/range_views.py @@ -24,7 +24,7 @@ class RangeListView(PaginatedListView): """ model = Post template_name = "posts/range_list.html" - queryset = Post.objects.filter(post_type__in=[PostType.ESSAY,PostType.FILM,PostType.HOWTO,PostType.REVIEW],status=1).order_by('-pub_date') + queryset = Post.objects.filter(post_type__in=[PostType.ESSAY,PostType.FILM,PostType.CRAFT,PostType.REVIEW],status=1).order_by('-pub_date') def get_context_data(self, **kwargs): context = super(RangeListView, self).get_context_data(**kwargs) |