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


Python SimplePage.allowed_subpage_types方法代码示例

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


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

示例1: test_allowed_subpage_types

# 需要导入模块: from wagtail.tests.testapp.models import SimplePage [as 别名]
# 或者: from wagtail.tests.testapp.models.SimplePage import allowed_subpage_types [as 别名]
    def test_allowed_subpage_types(self):
        # SimplePage does not define any restrictions on subpage types
        # SimplePage is a valid subpage of SimplePage
        self.assertIn(ContentType.objects.get_for_model(SimplePage), SimplePage.allowed_subpage_types())
        # BusinessIndex is a valid subpage of SimplePage
        self.assertIn(ContentType.objects.get_for_model(BusinessIndex), SimplePage.allowed_subpage_types())
        # BusinessSubIndex is not valid, because it explicitly omits SimplePage from parent_page_types
        self.assertNotIn(ContentType.objects.get_for_model(BusinessSubIndex), SimplePage.allowed_subpage_types())

        # BusinessChild has an empty subpage_types list, so does not allow anything
        self.assertNotIn(ContentType.objects.get_for_model(SimplePage), BusinessChild.allowed_subpage_types())
        self.assertNotIn(ContentType.objects.get_for_model(BusinessIndex), BusinessChild.allowed_subpage_types())
        self.assertNotIn(ContentType.objects.get_for_model(BusinessSubIndex), BusinessChild.allowed_subpage_types())

        # BusinessSubIndex only allows BusinessChild as subpage type
        self.assertNotIn(ContentType.objects.get_for_model(SimplePage), BusinessSubIndex.allowed_subpage_types())
        self.assertIn(ContentType.objects.get_for_model(BusinessChild), BusinessSubIndex.allowed_subpage_types())
开发者ID:noodle-learns-programming,项目名称:wagtail,代码行数:19,代码来源:test_page_model.py

示例2: test_allowed_subpage_types

# 需要导入模块: from wagtail.tests.testapp.models import SimplePage [as 别名]
# 或者: from wagtail.tests.testapp.models.SimplePage import allowed_subpage_types [as 别名]
    def test_allowed_subpage_types(self):
        """
        Same assertions as for test_allowed_subpage_models -
        allowed_subpage_types should mirror allowed_subpage_models with ContentType
        objects rather than model classes
        """

        with self.ignore_deprecation_warnings():
            # SimplePage does not define any restrictions on subpage types
            # SimplePage is a valid subpage of SimplePage
            self.assertIn(get_ct(SimplePage), SimplePage.allowed_subpage_types())
            # BusinessIndex is a valid subpage of SimplePage
            self.assertIn(get_ct(BusinessIndex), SimplePage.allowed_subpage_types())
            # BusinessSubIndex is not valid, because it explicitly omits SimplePage from parent_page_types
            self.assertNotIn(get_ct(BusinessSubIndex), SimplePage.allowed_subpage_types())

            # BusinessChild has an empty subpage_types list, so does not allow anything
            self.assertNotIn(get_ct(SimplePage), BusinessChild.allowed_subpage_types())
            self.assertNotIn(get_ct(BusinessIndex), BusinessChild.allowed_subpage_types())
            self.assertNotIn(get_ct(BusinessSubIndex), BusinessChild.allowed_subpage_types())

            # BusinessSubIndex only allows BusinessChild as subpage type
            self.assertNotIn(get_ct(SimplePage), BusinessSubIndex.allowed_subpage_types())
            self.assertIn(get_ct(BusinessChild), BusinessSubIndex.allowed_subpage_types())
开发者ID:serzans,项目名称:wagtail,代码行数:26,代码来源:test_page_model.py


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