Skip to content

Commit

Permalink
Fix get latests posts plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
fsbraun committed Oct 5, 2023
1 parent a76808e commit 378d916
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 8 deletions.
2 changes: 1 addition & 1 deletion djangocms_blog/cms_plugins.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def get_fields(self, request, obj=None):
def render(self, context, instance, placeholder):
"""Render the plugin."""
context = super().render(context, instance, placeholder)
context["posts_list"] = instance.get_posts(context["request"], published_only=False)
context["posts_list"] = instance.get_post_contents(context["request"])
context["TRUNCWORDS_COUNT"] = get_setting("POSTS_LIST_TRUNCWORDS_COUNT")
return context

Expand Down
4 changes: 2 additions & 2 deletions djangocms_blog/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -637,8 +637,8 @@ class BasePostPlugin(CMSPlugin):
)
template_folder = models.CharField(
max_length=200,
verbose_name=_("Plugin template"),
help_text=_("Select plugin template to load for this instance"),
verbose_name=_("Plugin laylout"),
help_text=_("Select plugin laylout to load for this instance"),
default=BLOG_PLUGIN_TEMPLATE_FOLDERS[0][0],
choices=BLOG_PLUGIN_TEMPLATE_FOLDERS,
)
Expand Down
6 changes: 1 addition & 5 deletions djangocms_blog/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,6 @@ def get_queryset(self):
queryset = self.model.admin_manager.latest_content()
else:
queryset = self.model.objects.all()
print(1, queryset, self.namespace)
queryset = queryset.filter(language=language, post__app_config__namespace=self.namespace)
setattr(self.request, get_setting("CURRENT_NAMESPACE"), self.config)
return self.optimize(queryset.on_site())
Expand All @@ -139,9 +138,7 @@ class PostListView(BaseConfigListViewMixin, ListView):
view_url_name = "djangocms_blog:posts-latest"

def get_queryset(self):
qs = super().get_queryset()
print(qs)
return qs
return super().get_queryset()


class CategoryListView(BlogConfigMixin, ViewUrlMixin, TranslatableSlugMixin, ListView):
Expand Down Expand Up @@ -252,7 +249,6 @@ def get_queryset(self):
qs = super().get_queryset()
if "category" in self.kwargs:
qs = qs.filter(post__categories=self.category.pk)
print(2, qs)
return self.optimize(qs)

def get_context_data(self, **kwargs):
Expand Down

0 comments on commit 378d916

Please sign in to comment.