本文整理汇总了Python中menus.templatetags.menu_tags.show_menu函数的典型用法代码示例。如果您正苦于以下问题:Python show_menu函数的具体用法?Python show_menu怎么用?Python show_menu使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了show_menu函数的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: test_16_softroot
def test_16_softroot(self):
page2 = Page.objects.get(pk=self.page2.pk)
page2.soft_root = True
page2.save()
context = self.get_context(path=page2.get_absolute_url())
nodes = show_menu(context, 0, 100, 100, 100)['children']
self.assertEqual(len(nodes), 1)
self.assertEqual(nodes[0].get_absolute_url(), page2.get_absolute_url())
page3 = Page.objects.get(pk=self.page3.pk)
context = self.get_context(path=page3.get_absolute_url())
nodes = show_menu(context, 0, 100, 100, 100)['children']
self.assertEqual(len(nodes), 1)
self.assertEqual(nodes[0].get_absolute_url(), page2.get_absolute_url())
page1 = Page.objects.get(pk=self.page1.pk)
context = self.get_context(path=page1.get_absolute_url())
nodes = show_menu(context, 0, 100, 100, 100)['children']
self.assertEqual(len(nodes), 2)
self.assertEqual(nodes[0].get_absolute_url(), page1.get_absolute_url())
self.assertEqual(len(nodes[0].children[0].children), 0)
context = self.get_context(path="/no/real/path/")
nodes = show_menu(context, 0, 100, 100, 100)['children']
self.assertEqual(len(nodes), 2)
self.assertEqual(nodes[0].get_absolute_url(), page1.get_absolute_url())
self.assertEqual(len(nodes[0].children[0].children), 0)
page5 = Page.objects.get(pk=self.page5.pk)
context = self.get_context(path=page5.get_absolute_url())
nodes = show_menu(context, 0, 100, 100, 100)['children']
self.assertEqual(len(nodes), 2)
self.assertEqual(nodes[0].get_absolute_url(), page1.get_absolute_url())
self.assertEqual(len(nodes[0].children[0].children), 0)
开发者ID:DrMeers,项目名称:django-cms-2.0,代码行数:33,代码来源:menu.py
示例2: test_17_show_submenu_from_non_menu_page
def test_17_show_submenu_from_non_menu_page(self):
page6 = Page.objects.get(pk=self.page6.pk)
context = self.get_context(page6.get_absolute_url())
nodes = show_menu(context, 1, 100, 0, 1)['children']
self.assertEqual(len(nodes), 0)
page7 = Page.objects.get(pk=self.page7.pk)
context = self.get_context(page7.get_absolute_url())
nodes = show_menu(context, 1, 100, 0, 1)['children']
self.assertEqual(len(nodes), 0)
开发者ID:Natim,项目名称:django-cms-2.0,代码行数:9,代码来源:menu.py
示例3: test_03_only_active_tree
def test_03_only_active_tree(self):
context = self.get_context()
# test standard show_menu
nodes = show_menu(context, 0, 100, 0, 100)['children']
self.assertEqual(len(nodes[1].children), 0)
self.assertEqual(len(nodes[0].children), 1)
self.assertEqual(len(nodes[0].children[0].children), 1)
context = self.get_context(path=self.page4.get_absolute_url())
nodes = show_menu(context, 0, 100, 0, 100)['children']
self.assertEqual(len(nodes[1].children), 1)
self.assertEqual(len(nodes[0].children), 0)
开发者ID:DrMeers,项目名称:django-cms-2.0,代码行数:11,代码来源:menu.py
示例4: test_06_only_level_one
def test_06_only_level_one(self):
context = self.get_context()
# test standard show_menu
nodes = show_menu(context, 1, 1, 100, 100)['children']
self.assertEqual(len(nodes), 2)
for node in nodes:
self.assertEqual(len(node.children), 0)
开发者ID:DrMeers,项目名称:django-cms-2.0,代码行数:7,代码来源:menu.py
示例5: test_04_only_one_active_level
def test_04_only_one_active_level(self):
context = self.get_context()
# test standard show_menu
nodes = show_menu(context, 0, 100, 0, 1)['children']
self.assertEqual(len(nodes[1].children), 0)
self.assertEqual(len(nodes[0].children), 1)
self.assertEqual(len(nodes[0].children[0].children), 0)
开发者ID:DrMeers,项目名称:django-cms-2.0,代码行数:7,代码来源:menu.py
示例6: test_07_only_level_one_active
def test_07_only_level_one_active(self):
context = self.get_context()
# test standard show_menu
nodes = show_menu(context, 1, 1, 0, 100)['children']
self.assertEqual(len(nodes), 1)
self.assertEqual(nodes[0].descendant, True)
self.assertEqual(len(nodes[0].children), 0)
开发者ID:DrMeers,项目名称:django-cms-2.0,代码行数:7,代码来源:menu.py
示例7: test_14_unpublished
def test_14_unpublished(self):
page2 = Page.objects.get(pk=self.page2.pk)
page2.published = False
page2.save()
context = self.get_context()
nodes = show_menu(context)['children']
self.assertEqual(len(nodes), 2)
self.assertEqual(len(nodes[0].children), 0)
开发者ID:DrMeers,项目名称:django-cms-2.0,代码行数:8,代码来源:menu.py
示例8: test_15_home_not_in_menu
def test_15_home_not_in_menu(self):
page1 = Page.objects.get(pk=self.page1.pk)
page1.in_navigation = False
page1.save()
page4 = Page.objects.get(pk=self.page4.pk)
page4.in_navigation = False
page4.save()
context = self.get_context()
nodes = show_menu(context, 0, 100, 100, 100)['children']
self.assertEqual(len(nodes), 1)
self.assertEqual(nodes[0].get_absolute_url(), "/%s/" % self.page2.get_slug())
self.assertEqual(nodes[0].children[0].get_absolute_url(), "/%s/%s/" % (self.page2.get_slug(), self.page3.get_slug()))
page4 = Page.objects.get(pk=self.page4.pk)
page4.in_navigation = True
page4.save()
menu_pool.clear(settings.SITE_ID)
context = self.get_context()
nodes = show_menu(context, 0, 100, 100, 100)['children']
self.assertEqual(len(nodes), 2)
开发者ID:DrMeers,项目名称:django-cms-2.0,代码行数:19,代码来源:menu.py
示例9: test_02_show_menu
def test_02_show_menu(self):
context = self.get_context()
# test standard show_menu
nodes = show_menu(context)['children']
self.assertEqual(len(nodes), 2)
self.assertEqual(nodes[0].selected, True)
self.assertEqual(nodes[0].sibling, False)
self.assertEqual(nodes[0].descendant, False)
self.assertEqual(nodes[0].children[0].descendant, True)
self.assertEqual(nodes[0].children[0].children[0].descendant, True)
self.assertEqual(nodes[0].get_absolute_url(), "/")
self.assertEqual(nodes[1].get_absolute_url(), self.page4.get_absolute_url())
self.assertEqual(nodes[1].sibling, True)
self.assertEqual(nodes[1].selected, False)
开发者ID:DrMeers,项目名称:django-cms-2.0,代码行数:15,代码来源:menu.py
示例10: test_05_only_level_zero
def test_05_only_level_zero(self):
context = self.get_context()
# test standard show_menu
nodes = show_menu(context, 0, 0, 0, 0)['children']
for node in nodes:
self.assertEqual(len(node.children), 0)
开发者ID:DrMeers,项目名称:django-cms-2.0,代码行数:6,代码来源:menu.py
示例11: test_15_empty_menu
def test_15_empty_menu(self):
Page.objects.all().delete()
request = self.get_request()
nodes = menu_pool.get_nodes(request)
context = self.get_context()
nodes = show_menu(context, 0, 100, 100, 100)['children']
开发者ID:DrMeers,项目名称:django-cms-2.0,代码行数:6,代码来源:menu.py
示例12: test_02_show_menu
def test_02_show_menu(self):
context = self.get_context()
nodes = show_menu(context)['children']
self.assertEqual(nodes[0].get_absolute_url(), self.get_pages_root())
self.assertEqual(nodes[0].get_absolute_url(), "/content/")
开发者ID:andrellima,项目名称:django-cms,代码行数:5,代码来源:nonroot.py
注:本文中的menus.templatetags.menu_tags.show_menu函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论