0
0
mirror of https://github.com/wagtail/wagtail.git synced 2024-12-01 03:31:04 +01:00

Refactor out a BoundHelpPanel class

This commit is contained in:
Matt Westcott 2022-03-15 00:51:56 +00:00 committed by Matt Westcott
parent 2fd7fe5ae6
commit 1c9015c8ce

View File

@ -611,6 +611,15 @@ class MultiFieldPanel(PanelGroup):
return classes
class BoundHelpPanel(BoundPanel):
def __init__(self, panel, instance, request, form):
super().__init__(panel, instance, request, form)
self.content = self.panel.content
def render(self):
return mark_safe(render_to_string(self.panel.template, {"self": self}))
class HelpPanel(Panel):
def __init__(
self,
@ -632,8 +641,8 @@ class HelpPanel(Panel):
)
return kwargs
def render(self):
return mark_safe(render_to_string(self.template, {"self": self}))
def get_bound_panel(self, instance=None, request=None, form=None):
return BoundHelpPanel(panel=self, instance=instance, request=request, form=form)
class BoundFieldPanel(BoundPanel):