From 663a4789b1645532045d5410ea081ce45e375750 Mon Sep 17 00:00:00 2001 From: Iacopo Spalletti Date: Sat, 15 Nov 2014 10:34:20 +0100 Subject: [PATCH 1/2] Remove djangocms-page-meta and djangocms-page-tags from Page menu in blog detail view to avoid confusion --- djangocms_blog/cms_toolbar.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/djangocms_blog/cms_toolbar.py b/djangocms_blog/cms_toolbar.py index 3e81a35..322cb8c 100644 --- a/djangocms_blog/cms_toolbar.py +++ b/djangocms_blog/cms_toolbar.py @@ -26,3 +26,23 @@ class BlogToolbar(CMSToolbar): admin_menu.add_modal_item(_('Edit Post'), reverse( 'admin:djangocms_blog_post_change', args=(current_post.pk,)), active=True) + + def post_template_populate(self): + current_post = getattr(self.request, BLOG_CURRENT_POST_IDENTIFIER, None) + if current_post and self.request.user.has_perm('djangocms_blog.change_post'): # pragma: no cover + # removing page meta menu, if present, to avoid confusion + try: # pragma: no cover + import djangocms_page_meta + menu = self.request.toolbar.get_or_create_menu('page') + pagemeta = menu.get_or_create_menu('pagemeta', 'meta') + menu.remove_item(pagemeta) + except ImportError: + pass + # removing page tags menu, if present, to avoid confusion + try: # pragma: no cover + import djangocms_page_meta + menu = self.request.toolbar.get_or_create_menu('page') + pagetags = menu.get_or_create_menu('pagetags', 'tags') + menu.remove_item(pagetags) + except ImportError: + pass From b9ef9d9be2425a98211bc386aa62f0d8a59f4754 Mon Sep 17 00:00:00 2001 From: Iacopo Spalletti Date: Tue, 2 Dec 2014 13:04:54 +0100 Subject: [PATCH 2/2] Update history --- HISTORY.rst | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/HISTORY.rst b/HISTORY.rst index a478969..f766d3a 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -12,7 +12,10 @@ History * Fix multilanguage issues * Fix SEO fields length * Post absolute url is generated from the title in any language if current is - not available.. + not available +* If djangocms-page-meta and djangocms-page-tags are installed, the relevant + toolbar items are removed from the toolbar in the post detail view to avoid + confusings page meta / tags with post ones 0.2.0 (2014-09-24) ++++++++++++++++++