Revert "Issue 4334: Excluded fields are also excluded when a panel set is exp… (#4363)"

This reverts commit 6b272c43e4.

Conflicts:
	wagtail/admin/tests/test_edit_handlers.py
This commit is contained in:
Matt Westcott 2018-05-16 11:44:14 +01:00
parent 8acb004a9f
commit 6ccd665e5e
2 changed files with 1 additions and 15 deletions

View file

@ -64,16 +64,7 @@ def get_form_for_model(
def extract_panel_definitions_from_model_class(model, exclude=None):
if hasattr(model, 'panels'):
panels = model.panels
if exclude is not None:
# Filter out fields in exclude
panels = [
panel for panel in panels
if isinstance(panel, FieldPanel) and panel.field_name not in exclude
]
return panels
return model.panels
panels = []

View file

@ -209,11 +209,6 @@ class TestExtractPanelDefinitionsFromModelClass(TestCase):
for panel in panels:
self.assertNotEqual(panel.field_name, 'hostname')
def test_exclude_with_defined_panels(self):
Site.panels = [FieldPanel('hostname')]
panels = extract_panel_definitions_from_model_class(Site, exclude=['hostname'])
self.assertEqual([], panels)
def test_can_build_panel_list(self):
# EventPage has no 'panels' definition, so one should be derived from the field list
panels = extract_panel_definitions_from_model_class(EventPage)