0
0
mirror of https://github.com/wagtail/wagtail.git synced 2024-11-28 08:48:04 +01:00

Use cached_property for PanelGroup.BoundPanel.children

This commit is contained in:
Matt Westcott 2022-03-22 22:07:33 +00:00
parent 199fe7ad76
commit 1b73b033a7

View File

@ -405,14 +405,16 @@ class PanelGroup(Panel):
def __init__(self, panel, instance, request, form):
super().__init__(panel=panel, instance=instance, request=request, form=form)
self.children = [
@cached_property
def children(self):
return [
child.get_bound_panel(
instance=self.instance, request=self.request, form=self.form
)
for child in self.panel.children
]
@property
@cached_property
def visible_children(self):
return [child for child in self.children if child.is_shown()]