8
8
from django .forms import Form , ModelForm
9
9
from reactpy import component , hooks , html , utils
10
10
from reactpy .core .events import event
11
- from reactpy .core .types import VdomDict
12
11
from reactpy .web import export , module_from_file
13
12
14
13
from reactpy_django .forms .transforms import (
24
23
if TYPE_CHECKING :
25
24
from collections .abc import Sequence
26
25
26
+ from reactpy .core .types import VdomDict
27
+
27
28
DjangoForm = export (
28
29
module_from_file ("reactpy-django" , file = Path (__file__ ).parent .parent / "static" / "reactpy_django" / "client.js" ),
29
30
("DjangoForm" ),
@@ -44,6 +45,8 @@ def _django_form(
44
45
top_children : Sequence ,
45
46
bottom_children : Sequence ,
46
47
):
48
+ from reactpy_django import config
49
+
47
50
uuid_ref = hooks .use_ref (uuid4 ().hex .replace ("-" , "" ))
48
51
top_children_count = hooks .use_ref (len (top_children ))
49
52
bottom_children_count = hooks .use_ref (len (bottom_children ))
@@ -84,7 +87,9 @@ async def render_form():
84
87
await database_sync_to_async (initialized_form .save )()
85
88
set_submitted_data (None )
86
89
87
- new_form = await database_sync_to_async (initialized_form .render )(form_template )
90
+ new_form = await database_sync_to_async (initialized_form .render )(
91
+ form_template or config .REACTPY_DEFAULT_FORM_TEMPLATE
92
+ )
88
93
if new_form != rendered_form :
89
94
set_rendered_form (new_form )
90
95
0 commit comments