Skip to content

Commit

Permalink
Fix get_postcontent_queryset to only show latest versions
Browse files Browse the repository at this point in the history
  • Loading branch information
fsbraun committed Oct 6, 2023
1 parent 1d8cacb commit ead0199
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions djangocms_blog/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -660,15 +660,15 @@ def optimize(self, qs):
def post_content_queryset(self, request=None):
language = translation.get_language()
if (request and getattr(request, "toolbar", False) and request.toolbar.edit_mode_active):
post_contents = PostContent.admin_manager
post_contents = PostContent.admin_manager.latest_content()
else:
post_contents = PostContent.objects
post_contents = PostContent.objects.all()
if self.app_config:
post_contents = post_contents.filter(post__app_config=self.app_config)
if self.current_site:
post_contents = post_contents.on_site(get_current_site(request))
post_contents = post_contents.filter(language=language)
return self.optimize(post_contents.all())
return self.optimize(post_contents)


class LatestPostsPlugin(BasePostPlugin):
Expand Down

0 comments on commit ead0199

Please sign in to comment.