From fd84b41914980d9ef0a57d48b6107248700f3322 Mon Sep 17 00:00:00 2001
From: Paul J Stevens
Date: Fri, 21 Apr 2023 09:55:16 +0200
Subject: [PATCH] follow the docs and use runtime import
---
wagtailstreamforms/blocks.py | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/wagtailstreamforms/blocks.py b/wagtailstreamforms/blocks.py
index 6e8c4387..b29ca153 100644
--- a/wagtailstreamforms/blocks.py
+++ b/wagtailstreamforms/blocks.py
@@ -5,9 +5,6 @@
from django.utils.translation import gettext_lazy as _
from wagtail import blocks
-from wagtailstreamforms.models import Form
-from wagtailstreamforms.wagtail_hooks import WagtailStreamFormsChooser
-
class InfoBlock(blocks.CharBlock):
def render_form(self, value, prefix="", errors=None):
@@ -19,10 +16,14 @@ def render_form(self, value, prefix="", errors=None):
class FormChooserBlock(blocks.ChooserBlock):
@cached_property
def target_model(self):
+ from .models import Form
+
return Form
@cached_property
def widget(self):
+ from .wagtail_hooks import WagtailStreamFormsChooser
+
return WagtailStreamFormsChooser()
def get_form_state(self, value):