本文整理汇总了Python中wagtail.tests.testapp.models.SimplePage.allowed_parent_page_types方法的典型用法代码示例。如果您正苦于以下问题:Python SimplePage.allowed_parent_page_types方法的具体用法?Python SimplePage.allowed_parent_page_types怎么用?Python SimplePage.allowed_parent_page_types使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类wagtail.tests.testapp.models.SimplePage
的用法示例。
在下文中一共展示了SimplePage.allowed_parent_page_types方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_allowed_parent_page_types
# 需要导入模块: from wagtail.tests.testapp.models import SimplePage [as 别名]
# 或者: from wagtail.tests.testapp.models.SimplePage import allowed_parent_page_types [as 别名]
def test_allowed_parent_page_types(self):
# SimplePage does not define any restrictions on parent page types
# SimplePage is a valid parent page of SimplePage
self.assertIn(ContentType.objects.get_for_model(SimplePage), SimplePage.allowed_parent_page_types())
# BusinessChild cannot be a parent of anything
self.assertNotIn(ContentType.objects.get_for_model(BusinessChild), SimplePage.allowed_parent_page_types())
# StandardIndex does not allow anything as a parent
self.assertNotIn(ContentType.objects.get_for_model(SimplePage), StandardIndex.allowed_parent_page_types())
self.assertNotIn(ContentType.objects.get_for_model(StandardIndex), StandardIndex.allowed_parent_page_types())
# BusinessSubIndex only allows BusinessIndex as a parent
self.assertNotIn(ContentType.objects.get_for_model(SimplePage), BusinessSubIndex.allowed_parent_page_types())
self.assertIn(ContentType.objects.get_for_model(BusinessIndex), BusinessSubIndex.allowed_parent_page_types())
示例2: test_allowed_parent_page_types
# 需要导入模块: from wagtail.tests.testapp.models import SimplePage [as 别名]
# 或者: from wagtail.tests.testapp.models.SimplePage import allowed_parent_page_types [as 别名]
def test_allowed_parent_page_types(self):
"""
Same assertions as for test_allowed_parent_page_models -
allowed_parent_page_types should mirror allowed_parent_page_models
with ContentType objects rather than model classes
"""
with self.ignore_deprecation_warnings():
# SimplePage does not define any restrictions on parent page types
# SimplePage is a valid parent page of SimplePage
self.assertIn(get_ct(SimplePage), SimplePage.allowed_parent_page_types())
# BusinessChild cannot be a parent of anything
self.assertNotIn(get_ct(BusinessChild), SimplePage.allowed_parent_page_types())
# BusinessNowherePage does not allow anything as a parent
self.assertNotIn(get_ct(SimplePage), BusinessNowherePage.allowed_parent_page_types())
self.assertNotIn(get_ct(StandardIndex), BusinessNowherePage.allowed_parent_page_types())
# BusinessSubIndex only allows BusinessIndex as a parent
self.assertNotIn(get_ct(SimplePage), BusinessSubIndex.allowed_parent_page_types())
self.assertIn(get_ct(BusinessIndex), BusinessSubIndex.allowed_parent_page_types())