From e7bd1945b4049e579b6afa6a5e281ba083a3d8c9 Mon Sep 17 00:00:00 2001 From: Fabian Braun Date: Fri, 6 Oct 2023 10:56:03 +0200 Subject: [PATCH] Fix toolbar: App name as menu name and create articles of current config (if avail) --- djangocms_blog/cms_toolbars.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/djangocms_blog/cms_toolbars.py b/djangocms_blog/cms_toolbars.py index 98f5b508..733f345b 100644 --- a/djangocms_blog/cms_toolbars.py +++ b/djangocms_blog/cms_toolbars.py @@ -98,7 +98,10 @@ def populate(self): self.request, get_setting("CURRENT_NAMESPACE"), current_content.app_config if current_content else None ) with override(self.current_lang): - admin_menu = self.toolbar.get_or_create_menu("djangocms_blog", _("Blog")) + menu_name = _("Blog") + if current_config and current_config.app_title: + menu_name = current_config.app_title + admin_menu = self.toolbar.get_or_create_menu("djangocms_blog", menu_name) object_dict = ( dict(object_name=current_config.object_name) if current_config @@ -110,6 +113,8 @@ def populate(self): admin_reverse("djangocms_blog_post_change", args=(current_content.post.pk,)), ) url = admin_reverse("djangocms_blog_post_add") + if current_config: + url += f"?app_config={current_config.pk}" admin_menu.add_modal_item( _("Create %(object_name)s") % object_dict, url=url,