From 378d9166b4c23b0aaa46c1878fd44fd93d6d9098 Mon Sep 17 00:00:00 2001 From: Fabian Braun Date: Thu, 5 Oct 2023 23:21:45 +0200 Subject: [PATCH] Fix get latests posts plugin --- djangocms_blog/cms_plugins.py | 2 +- djangocms_blog/models.py | 4 ++-- djangocms_blog/views.py | 6 +----- 3 files changed, 4 insertions(+), 8 deletions(-) diff --git a/djangocms_blog/cms_plugins.py b/djangocms_blog/cms_plugins.py index cd5b0d1d..cc132b0c 100644 --- a/djangocms_blog/cms_plugins.py +++ b/djangocms_blog/cms_plugins.py @@ -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 diff --git a/djangocms_blog/models.py b/djangocms_blog/models.py index 8d487144..f33461e7 100644 --- a/djangocms_blog/models.py +++ b/djangocms_blog/models.py @@ -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, ) diff --git a/djangocms_blog/views.py b/djangocms_blog/views.py index 5014b2bf..47043abb 100644 --- a/djangocms_blog/views.py +++ b/djangocms_blog/views.py @@ -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()) @@ -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): @@ -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):