當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。