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


Python edit_handlers.FieldPanel方法代码示例

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


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

示例1: test_model_with_single_tabbed_panel_only

# 需要导入模块: from wagtail.admin import edit_handlers [as 别名]
# 或者: from wagtail.admin.edit_handlers import FieldPanel [as 别名]
def test_model_with_single_tabbed_panel_only(self):

        StandardSnippet.content_panels = [FieldPanel('text')]

        warning = checks.Warning(
            "StandardSnippet.content_panels will have no effect on snippets editing",
            hint="""Ensure that StandardSnippet uses `panels` instead of `content_panels`\
or set up an `edit_handler` if you want a tabbed editing interface.
There are no default tabs on non-Page models so there will be no\
 Content tab for the content_panels to render in.""",
            obj=StandardSnippet,
            id='wagtailadmin.W002',
        )

        checks_results = self.get_checks_result()

        self.assertEqual([warning], checks_results)

        # clean up for future checks
        delattr(StandardSnippet, 'content_panels') 
开发者ID:wagtail,项目名称:wagtail,代码行数:22,代码来源:tests.py

示例2: test_model_with_single_tabbed_panel_only

# 需要导入模块: from wagtail.admin import edit_handlers [as 别名]
# 或者: from wagtail.admin.edit_handlers import FieldPanel [as 别名]
def test_model_with_single_tabbed_panel_only(self):

        Publisher.content_panels = [FieldPanel('name'), FieldPanel('headquartered_in')]

        warning = checks.Warning(
            "Publisher.content_panels will have no effect on modeladmin editing",
            hint="""Ensure that Publisher uses `panels` instead of `content_panels`\
or set up an `edit_handler` if you want a tabbed editing interface.
There are no default tabs on non-Page models so there will be no\
 Content tab for the content_panels to render in.""",
            obj=Publisher,
            id='wagtailadmin.W002',
        )

        checks_results = self.get_checks_result()

        self.assertIn(warning, checks_results)

        # clean up for future checks
        delattr(Publisher, 'content_panels') 
开发者ID:wagtail,项目名称:wagtail,代码行数:22,代码来源:test_simple_modeladmin.py

示例3: test_model_with_two_tabbed_panels_only

# 需要导入模块: from wagtail.admin import edit_handlers [as 别名]
# 或者: from wagtail.admin.edit_handlers import FieldPanel [as 别名]
def test_model_with_two_tabbed_panels_only(self):

        Publisher.settings_panels = [FieldPanel('name')]
        Publisher.promote_panels = [FieldPanel('headquartered_in')]


        warning_1 = checks.Warning(
            "Publisher.promote_panels will have no effect on modeladmin editing",
            hint="""Ensure that Publisher uses `panels` instead of `promote_panels`\
or set up an `edit_handler` if you want a tabbed editing interface.
There are no default tabs on non-Page models so there will be no\
 Promote tab for the promote_panels to render in.""",
            obj=Publisher,
            id='wagtailadmin.W002',
        )

        warning_2 = checks.Warning(
            "Publisher.settings_panels will have no effect on modeladmin editing",
            hint="""Ensure that Publisher uses `panels` instead of `settings_panels`\
or set up an `edit_handler` if you want a tabbed editing interface.
There are no default tabs on non-Page models so there will be no\
 Settings tab for the settings_panels to render in.""",
            obj=Publisher,
            id='wagtailadmin.W002',
        )

        checks_results = self.get_checks_result()

        self.assertIn(warning_1, checks_results)
        self.assertIn(warning_2, checks_results)

        # clean up for future checks
        delattr(Publisher, 'settings_panels')
        delattr(Publisher, 'promote_panels') 
开发者ID:wagtail,项目名称:wagtail,代码行数:36,代码来源:test_simple_modeladmin.py

示例4: test_model_with_single_tabbed_panel_and_edit_handler

# 需要导入模块: from wagtail.admin import edit_handlers [as 别名]
# 或者: from wagtail.admin.edit_handlers import FieldPanel [as 别名]
def test_model_with_single_tabbed_panel_and_edit_handler(self):

        Publisher.content_panels = [FieldPanel('name'), FieldPanel('headquartered_in')]
        Publisher.edit_handler = TabbedInterface(Publisher.content_panels)

        # no errors should occur
        self.assertEqual(self.get_checks_result(), [])

        # clean up for future checks
        delattr(Publisher, 'content_panels')
        delattr(Publisher, 'edit_handler') 
开发者ID:wagtail,项目名称:wagtail,代码行数:13,代码来源:test_simple_modeladmin.py

示例5: test_default_model_introspection

# 需要导入模块: from wagtail.admin import edit_handlers [as 别名]
# 或者: from wagtail.admin.edit_handlers import FieldPanel [as 别名]
def test_default_model_introspection(self):
        handler = get_setting_edit_handler(TestSetting)
        self.assertIsInstance(handler, ObjectList)
        self.assertEqual(len(handler.children), 2)
        first = handler.children[0]
        self.assertIsInstance(first, FieldPanel)
        self.assertEqual(first.field_name, 'title')
        second = handler.children[1]
        self.assertIsInstance(second, FieldPanel)
        self.assertEqual(second.field_name, 'email') 
开发者ID:wagtail,项目名称:wagtail,代码行数:12,代码来源:test_admin.py


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