本文整理汇总了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')
示例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')
示例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')
示例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')
示例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')