diff --git a/ietf/blog/models.py b/ietf/blog/models.py index ee3cbee4..f142a661 100644 --- a/ietf/blog/models.py +++ b/ietf/blog/models.py @@ -218,6 +218,7 @@ def feed_text(self): @functional.cached_property def siblings(self): + """Published siblings that match filter_topic, most recent first""" qs = self.__class__.objects.live().sibling_of(self).annotate( d=Coalesce('date_published', 'first_published_at') ).order_by('-d') @@ -228,6 +229,7 @@ def siblings(self): def get_context(self, request, *args, **kwargs): context = super(BlogPage, self).get_context(request, *args, **kwargs) siblings = self.siblings + max_siblings_to_show = 5 query_string = "?" filter_text_builder = build_filter_text feed_settings = FeedSettings.for_site(request.site) @@ -253,11 +255,6 @@ def get_context(self, request, *args, **kwargs): else: filter_text = self.filter_topic.title - if self.coalesced_published_date(): - siblings = siblings.filter(d__lt=self.coalesced_published_date() or datetime.now())[:5] - else: - siblings = siblings.none() - if filter_text: if siblings: filter_text = mark_safe("You have filtered by " + filter_text) @@ -268,7 +265,7 @@ def get_context(self, request, *args, **kwargs): parent_url=self.get_parent().url, filter_text = filter_text, filter_topic = self.filter_topic, - siblings=siblings, + siblings=siblings[:max_siblings_to_show], topics=BlogPageTopic.objects.all().values_list( 'topic__pk', 'topic__title' ).distinct(),