diff options
author | luxagraf <sng@luxagraf.net> | 2023-05-28 09:40:10 -0500 |
---|---|---|
committer | luxagraf <sng@luxagraf.net> | 2023-05-28 09:40:10 -0500 |
commit | 7ba1f6de4a39d294594dc1e93a58400f6991398f (patch) | |
tree | 7688589c7eba6dbb3a70e5ee427407f63d31842a /app/posts/views | |
parent | 0abca069496494707496fe4e129c92e18fac81e2 (diff) |
jrnl: finished up trip section
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'] |