Skip to content

Commit 63e23d5

Browse files
committed
Remove auto submit from the base form
1 parent f0702d0 commit 63e23d5

File tree

2 files changed

+5
-25
lines changed

2 files changed

+5
-25
lines changed

src/reactpy_django/components.py

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -117,22 +117,9 @@ def django_js(static_path: str, key: Key | None = None):
117117

118118

119119
def django_form(
120-
form: type[Form],
121-
*,
122-
top_children: Sequence = (),
123-
bottom_children: Sequence = (),
124-
auto_submit: bool = False,
125-
auto_submit_wait: int = 3,
126-
key: Key | None = None,
120+
form: type[Form], *, top_children: Sequence = (), bottom_children: Sequence = (), key: Key | None = None
127121
):
128-
return _django_form(
129-
form=form,
130-
top_children=top_children,
131-
bottom_children=bottom_children,
132-
auto_submit=auto_submit,
133-
auto_submit_wait=auto_submit_wait,
134-
key=key,
135-
)
122+
return _django_form(form=form, top_children=top_children, bottom_children=bottom_children, key=key)
136123

137124

138125
def pyscript_component(

src/reactpy_django/forms/components.py

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
from __future__ import annotations
22

33
from pathlib import Path
4+
from pprint import pprint
45
from typing import TYPE_CHECKING, Any
56
from uuid import uuid4
67

@@ -28,16 +29,8 @@
2829
)
2930

3031

31-
# DjangoFormAutoSubmit = export(
32-
# module_from_file("reactpy-django", file=Path(__file__).parent / "static" / "reactpy_django" / "client.js"),
33-
# ("DjangoFormAutoSubmit"),
34-
# )
35-
36-
3732
@component
38-
def _django_form(
39-
form: type[Form], top_children: Sequence, bottom_children: Sequence, auto_submit: bool, auto_submit_wait: int
40-
):
33+
def _django_form(form: type[Form], top_children: Sequence, bottom_children: Sequence):
4134
# TODO: Implement form restoration on page reload. Probably want to create a new setting called
4235
# form_restoration_method that can be set to "URL", "CLIENT_STORAGE", "SERVER_SESSION", or None.
4336
# Or maybe just recommend pre-rendering to have the browser handle it.
@@ -87,7 +80,7 @@ def on_submit_callback(new_data: dict[str, Any]):
8780
if submitted_data != new_data:
8881
set_submitted_data(new_data)
8982

90-
async def on_change(_event):
83+
def on_change(_event):
9184
last_changed.set_current(timezone.now())
9285

9386
rendered_form = utils.html_to_vdom(

0 commit comments

Comments
 (0)