diff options
Diffstat (limited to 'app/posts/models.py')
-rw-r--r-- | app/posts/models.py | 12 |
1 files changed, 9 insertions, 3 deletions
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) |