Python wagtail.admin.edit_handlers.FieldPanel() Examples
The following are 5
code examples of wagtail.admin.edit_handlers.FieldPanel().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
wagtail.admin.edit_handlers
, or try the search function
.
Example #1
Source File: tests.py From wagtail with BSD 3-Clause "New" or "Revised" License | 6 votes |
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')
Example #2
Source File: test_simple_modeladmin.py From wagtail with BSD 3-Clause "New" or "Revised" License | 6 votes |
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')
Example #3
Source File: test_simple_modeladmin.py From wagtail with BSD 3-Clause "New" or "Revised" License | 5 votes |
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')
Example #4
Source File: test_simple_modeladmin.py From wagtail with BSD 3-Clause "New" or "Revised" License | 5 votes |
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')
Example #5
Source File: test_admin.py From wagtail with BSD 3-Clause "New" or "Revised" License | 5 votes |
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')