kopia lustrzana https://github.com/wagtail/wagtail
Add ability to extend EditHandler without a children attribute
- Only run checks on children for tabs that use BaseCompositeEditHandler (have children)pull/6117/head
rodzic
390a070494
commit
b9347ee970
|
@ -44,6 +44,7 @@ Changelog
|
|||
* Allow omitting the default editor from `WAGTAILADMIN_RICH_TEXT_EDITORS` (Gassan Gousseinov)
|
||||
* Disable password auto-completion on user creation form (Samir Shah)
|
||||
* Upgrade jQuery to version 3.5.1 to reduce penetration testing false positives (Matt Westcott)
|
||||
* Add ability to extend `EditHandler` without a children attribute (Seb Brown)
|
||||
* Fix: Support IPv6 domain (Alex Gleason, Coen van der Kamp)
|
||||
* Fix: Ensure link to add a new user works when no users are visible in the users list (LB (Ben Johnston))
|
||||
* Fix: `AbstractEmailForm` saved submission fields are now aligned with the email content fields, `form.cleaned_data` will be used instead of `form.fields` (Haydn Greatnews)
|
||||
|
|
|
@ -62,6 +62,7 @@ Other features
|
|||
* Allow omitting the default editor from ``WAGTAILADMIN_RICH_TEXT_EDITORS`` (Gassan Gousseinov)
|
||||
* Disable password auto-completion on user creation form (Samir Shah)
|
||||
* Upgrade jQuery to version 3.5.1 to reduce penetration testing false positives (Matt Westcott)
|
||||
* Add ability to extend ``EditHandler`` without a children attribute (Seb Brown)
|
||||
|
||||
|
||||
Bug fixes
|
||||
|
|
|
@ -93,7 +93,7 @@ def inline_panel_model_panels_check(app_configs, **kwargs):
|
|||
def check_panels_in_model(cls, context='model'):
|
||||
"""Check panels configuration uses `panels` when `edit_handler` not in use."""
|
||||
from wagtail.core.models import Page
|
||||
from wagtail.admin.edit_handlers import InlinePanel
|
||||
from wagtail.admin.edit_handlers import BaseCompositeEditHandler, InlinePanel
|
||||
|
||||
errors = []
|
||||
|
||||
|
@ -101,13 +101,14 @@ def check_panels_in_model(cls, context='model'):
|
|||
# must check the InlinePanel related models
|
||||
edit_handler = cls.get_edit_handler()
|
||||
for tab in edit_handler.children:
|
||||
inline_panel_children = [
|
||||
panel for panel in tab.children if isinstance(panel, InlinePanel)]
|
||||
for inline_panel_child in inline_panel_children:
|
||||
errors.extend(check_panels_in_model(
|
||||
inline_panel_child.db_field.related_model,
|
||||
context='InlinePanel model',
|
||||
))
|
||||
if isinstance(tab, BaseCompositeEditHandler):
|
||||
inline_panel_children = [
|
||||
panel for panel in tab.children if isinstance(panel, InlinePanel)]
|
||||
for inline_panel_child in inline_panel_children:
|
||||
errors.extend(check_panels_in_model(
|
||||
inline_panel_child.db_field.related_model,
|
||||
context='InlinePanel model',
|
||||
))
|
||||
|
||||
if issubclass(cls, Page) or hasattr(cls, 'edit_handler'):
|
||||
# Pages do not need to be checked for standalone tabbed_panel usage
|
||||
|
|
Ładowanie…
Reference in New Issue