From 963f7d4d32da3d274795d02a91e5dea1b9f36e86 Mon Sep 17 00:00:00 2001 From: lxf Date: Sat, 31 May 2025 13:10:29 -0500 Subject: fixed a couple bugs so that all the navigationn works with combined jrnl format --- app/pages/views.py | 2 +- app/posts/models.py | 12 +++++++++--- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/app/pages/views.py b/app/pages/views.py index d4c4880..4becff8 100644 --- a/app/pages/views.py +++ b/app/pages/views.py @@ -35,7 +35,7 @@ class HomePageList(DetailView): def get_context_data(self, **kwargs): # Call the base implementation first to get a context context = super(HomePageList, self).get_context_data(**kwargs) - context['object_list'] = Post.objects.filter(post_type=PostType.JRNL).filter(status__exact=1).order_by('-pub_date').exclude().select_related('location').select_related('featured_image')[1:9] + context['object_list'] = Post.objects.filter(post_type__in=[PostType.JRNL,PostType.ESSAY, PostType.PHOTO_ESSAY]).filter(status__exact=1).order_by('-pub_date').exclude().select_related('location').select_related('featured_image')[1:9] context['location'] = LuxCheckIn.objects.latest() return context diff --git a/app/posts/models.py b/app/posts/models.py index 94adf6c..997e5de 100644 --- a/app/posts/models.py +++ b/app/posts/models.py @@ -158,7 +158,10 @@ class Post(models.Model): @property def get_previous_published(self): - return self.get_previous_by_pub_date(status__exact=1,post_type=self.post_type) + if self.post_type in (2, 4, 6): + return self.get_previous_by_pub_date(status__exact=1,post_type__in=[2,4,6]) + else: + return self.get_previous_by_pub_date(status__exact=1,post_type=self.post_type) @property def get_previous_admin_url(self): @@ -167,8 +170,11 @@ class Post(models.Model): @property def get_next_published(self): - return self.get_next_by_pub_date(status__exact=1,post_type=self.post_type) - + if self.post_type in (2, 4, 6): + return self.get_next_by_pub_date(status__exact=1,post_type__in=[2,4,6]) + else: + return self.get_next_by_pub_date(status__exact=1,post_type=self.post_type) + @property def get_next_admin_url(self): model = apps.get_model(app_label=self._meta.app_label, model_name=self._meta.model_name) -- cgit v1.2.3