当前位置: 首页>>代码示例>>Python>>正文


Python CMSToolbar.post_template_populate方法代码示例

本文整理汇总了Python中cms.toolbar.toolbar.CMSToolbar.post_template_populate方法的典型用法代码示例。如果您正苦于以下问题:Python CMSToolbar.post_template_populate方法的具体用法?Python CMSToolbar.post_template_populate怎么用?Python CMSToolbar.post_template_populate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在cms.toolbar.toolbar.CMSToolbar的用法示例。


在下文中一共展示了CMSToolbar.post_template_populate方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_no_page_anon

# 需要导入模块: from cms.toolbar.toolbar import CMSToolbar [as 别名]
# 或者: from cms.toolbar.toolbar.CMSToolbar import post_template_populate [as 别名]
 def test_no_page_anon(self):
     request = self.get_page_request(None, self.get_anon(), '/')
     toolbar = CMSToolbar(request)
     toolbar.populate()
     toolbar.post_template_populate()
     items = toolbar.get_left_items() + toolbar.get_right_items()
     self.assertEqual(len(items), 0)
开发者ID:Konviser,项目名称:django-cms,代码行数:9,代码来源:toolbar.py

示例2: test_publish_button

# 需要导入模块: from cms.toolbar.toolbar import CMSToolbar [as 别名]
# 或者: from cms.toolbar.toolbar.CMSToolbar import post_template_populate [as 别名]
 def test_publish_button(self):
     page = create_page('test', 'nav_playground.html', 'en', published=True)
     request = self.get_page_request(page, self.get_superuser(), edit=True)
     toolbar = CMSToolbar(request)
     toolbar.populate()
     toolbar.post_template_populate()
     self.assertTrue(toolbar.edit_mode)
     items = toolbar.get_left_items() + toolbar.get_right_items()
     self.assertEqual(len(items), 7)
开发者ID:Konviser,项目名称:django-cms,代码行数:11,代码来源:toolbar.py

示例3: test_no_page_staff

# 需要导入模块: from cms.toolbar.toolbar import CMSToolbar [as 别名]
# 或者: from cms.toolbar.toolbar.CMSToolbar import post_template_populate [as 别名]
 def test_no_page_staff(self):
     request = self.get_page_request(None, self.get_staff(), '/')
     toolbar = CMSToolbar(request)
     toolbar.populate()
     toolbar.post_template_populate()
     items = toolbar.get_left_items() + toolbar.get_right_items()
     # Logo + admin-menu + logout
     self.assertEqual(len(items), 2, items)
     admin_items = toolbar.get_or_create_menu(ADMIN_MENU_IDENTIFIER, 'Test').get_items()
     self.assertEqual(len(admin_items), 6, admin_items)
开发者ID:Konviser,项目名称:django-cms,代码行数:12,代码来源:toolbar.py

示例4: test_no_publish_button

# 需要导入模块: from cms.toolbar.toolbar import CMSToolbar [as 别名]
# 或者: from cms.toolbar.toolbar.CMSToolbar import post_template_populate [as 别名]
 def test_no_publish_button(self):
     page = create_page('test', 'nav_playground.html', 'en', published=True)
     request = self.get_page_request(page, self.get_staff(), edit=True)
     toolbar = CMSToolbar(request)
     toolbar.populate()
     toolbar.post_template_populate()
     self.assertTrue(page.has_change_permission(request))
     self.assertFalse(page.has_publish_permission(request))
     self.assertTrue(toolbar.edit_mode)
     items = toolbar.get_left_items() + toolbar.get_right_items()
     # Logo + edit-mode + templates + page-menu + admin-menu + logout
     self.assertEqual(len(items), 6)
开发者ID:Konviser,项目名称:django-cms,代码行数:14,代码来源:toolbar.py

示例5: test_no_page_superuser

# 需要导入模块: from cms.toolbar.toolbar import CMSToolbar [as 别名]
# 或者: from cms.toolbar.toolbar.CMSToolbar import post_template_populate [as 别名]
    def test_no_page_superuser(self):
        request = self.get_page_request(None, self.get_superuser(), '/')
        toolbar = CMSToolbar(request)
        toolbar.populate()
        toolbar.post_template_populate()
        items = toolbar.get_left_items() + toolbar.get_right_items()
        # Logo + edit-mode + admin-menu + logout
        self.assertEqual(len(items), 2)
        admin_items = toolbar.get_or_create_menu(ADMIN_MENU_IDENTIFIER, 'Test').get_items()

        if is_user_swapped:
            self.assertEqual(len(admin_items), 6, admin_items)
        else:
            self.assertEqual(len(admin_items), 7, admin_items)
开发者ID:Konviser,项目名称:django-cms,代码行数:16,代码来源:toolbar.py

示例6: test_no_change_button

# 需要导入模块: from cms.toolbar.toolbar import CMSToolbar [as 别名]
# 或者: from cms.toolbar.toolbar.CMSToolbar import post_template_populate [as 别名]
    def test_no_change_button(self):
        page = create_page('test', 'nav_playground.html', 'en', published=True)
        user = self.get_staff()
        user.user_permissions.all().delete()
        request = self.get_page_request(page, user, edit=True)
        toolbar = CMSToolbar(request)
        toolbar.populate()
        toolbar.post_template_populate()
        self.assertFalse(page.has_change_permission(request))
        self.assertFalse(page.has_publish_permission(request))

        items = toolbar.get_left_items() + toolbar.get_right_items()
        # Logo + page-menu + admin-menu + logout
        self.assertEqual(len(items), 3, items)
        admin_items = toolbar.get_or_create_menu(ADMIN_MENU_IDENTIFIER, 'Test').get_items()
        self.assertEqual(len(admin_items), 6, admin_items)
开发者ID:Konviser,项目名称:django-cms,代码行数:18,代码来源:toolbar.py

示例7: test_button_consistency_staff

# 需要导入模块: from cms.toolbar.toolbar import CMSToolbar [as 别名]
# 或者: from cms.toolbar.toolbar.CMSToolbar import post_template_populate [as 别名]
 def test_button_consistency_staff(self):
     """
     Tests that the buttons remain even when the language changes.
     """
     user = self.get_staff()
     cms_page = create_page('test-en', 'nav_playground.html', 'en', published=True)
     create_title('de', 'test-de', cms_page)
     cms_page.publish('de')
     en_request = self.get_page_request(cms_page, user, edit=True)
     en_toolbar = CMSToolbar(en_request)
     en_toolbar.populate()
     en_toolbar.post_template_populate()
     self.assertEqual(len(en_toolbar.get_left_items() + en_toolbar.get_right_items()), 6)
     de_request = self.get_page_request(cms_page, user, path='/de/', edit=True, lang_code='de')
     de_toolbar = CMSToolbar(de_request)
     de_toolbar.populate()
     de_toolbar.post_template_populate()
     self.assertEqual(len(de_toolbar.get_left_items() + de_toolbar.get_right_items()), 6)
开发者ID:Konviser,项目名称:django-cms,代码行数:20,代码来源:toolbar.py

示例8: test_toolbar_with_items

# 需要导入模块: from cms.toolbar.toolbar import CMSToolbar [as 别名]
# 或者: from cms.toolbar.toolbar.CMSToolbar import post_template_populate [as 别名]
    def test_toolbar_with_items(self):
        """
        Test that Blog toolbar is present and contains all items
        """
        from cms.toolbar.toolbar import CMSToolbar
        posts = self.get_posts()
        pages = self.get_pages()
        request = self.get_page_request(pages[0], self.user, r'/en/blog/', edit=True)
        setattr(request, BLOG_CURRENT_POST_IDENTIFIER, posts[0])

        posts[0].publish = False
        posts[0].save()
        toolbar = CMSToolbar(request)
        toolbar.populate()
        toolbar.post_template_populate()
        toolbar.get_left_items()
        blog_menu = toolbar.menus['djangocms_blog']
        self.assertEqual(len(blog_menu.find_items(ModalItem, url=reverse('admin:djangocms_blog_post_changelist'))), 1)
        self.assertEqual(len(blog_menu.find_items(ModalItem, url=reverse('admin:djangocms_blog_post_add'))), 1)
        self.assertEqual(len(blog_menu.find_items(ModalItem, url=reverse('admin:djangocms_blog_post_change', args=(posts[0].pk,)))), 1)

        # Publish button only appears if current post is unpublished
        right = toolbar.get_right_items()
        buttons = sum([item.buttons for item in right if isinstance(item, ButtonList)], [])
        self.assertTrue([button for button in buttons if force_text(button.name) == 'Publish Blog now'])

        # Publish button does not appears if current post is published
        posts[0].publish = True
        posts[0].save()
        toolbar = CMSToolbar(request)
        toolbar.populate()
        toolbar.post_template_populate()
        right = toolbar.get_right_items()
        buttons = sum([item.buttons for item in right if isinstance(item, ButtonList)], [])
        self.assertFalse([button for button in buttons if force_text(button.name) == 'Publish Blog now'])

        # Publish button does not appears if other posts but the current one are unpublished
        posts[1].publish = True
        posts[1].save()
        toolbar = CMSToolbar(request)
        toolbar.populate()
        toolbar.post_template_populate()
        right = toolbar.get_right_items()
        buttons = sum([item.buttons for item in right if isinstance(item, ButtonList)], [])
        self.assertFalse([button for button in buttons if force_text(button.name) == 'Publish Blog now'])
开发者ID:Darex1991,项目名称:djangocms-blog,代码行数:47,代码来源:test_toolbar.py

示例9: get_toolbar

# 需要导入模块: from cms.toolbar.toolbar import CMSToolbar [as 别名]
# 或者: from cms.toolbar.toolbar.CMSToolbar import post_template_populate [as 别名]
 def get_toolbar(self, request):
     toolbar = CMSToolbar(request)
     toolbar.populate()
     toolbar.post_template_populate()
     return toolbar
开发者ID:aldryn,项目名称:things,代码行数:7,代码来源:test_toolbar.py


注:本文中的cms.toolbar.toolbar.CMSToolbar.post_template_populate方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。