diff options
Diffstat (limited to 'app/posts/views/essay_views.py')
-rw-r--r-- | app/posts/views/essay_views.py | 23 |
1 files changed, 22 insertions, 1 deletions
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" |