diff options
Diffstat (limited to 'app/posts/views')
-rw-r--r-- | app/posts/views/trip_views.py | 18 |
1 files changed, 4 insertions, 14 deletions
diff --git a/app/posts/views/trip_views.py b/app/posts/views/trip_views.py index 0079652..5753069 100644 --- a/app/posts/views/trip_views.py +++ b/app/posts/views/trip_views.py @@ -17,22 +17,12 @@ class TripListView(PaginatedListView): template_name = "posts/trips_list.html" class TripDetailView(LuxDetailView): - model = Post + model = Trip slug_field = "slug" + template_name = "posts/trip_detail.html" - def get_queryset(self): - queryset = super(PostDetailView, self).get_queryset() - return queryset.select_related('location').prefetch_related('field_notes') def get_context_data(self, **kwargs): - context = super(PostDetailView, self).get_context_data(**kwargs) - related = [] - for obj in self.object.related.all(): - model = apps.get_model(obj.model_name.app_label, obj.model_name.model) - related.append(model.objects.get(slug=obj.slug, pub_date=obj.pub_date)) - context['related'] = related + context = super(TripDetailView, self).get_context_data(**kwargs) + context['posts'] = Post.objects.filter(status__exact=1,trip=self.object) return context - - def get_template_names(self): - obj = self.get_object() - return ["posts/%s_detail.html" % obj.get_post_type_display(), 'posts/post_detail.html'] |