Skip to content

Commit 491d030

Browse files
committed
Change arg name to turbo_stream_template from partial
1 parent 5d5bb3f commit 491d030

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

src/turbo_response/shortcuts.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ def render_form_response(
2929
template: Union[str, List[str]],
3030
context: Optional[Dict] = None,
3131
*,
32-
partial_template: Optional[Union[str, List[str]]] = None,
32+
turbo_stream_template: Optional[Union[str, List[str]]] = None,
3333
turbo_stream_target: Optional[str] = None,
3434
turbo_stream_action: Action = Action.REPLACE,
3535
**response_kwargs,
@@ -45,11 +45,11 @@ def render_form_response(
4545
if turbo_stream_target:
4646
context["turbo_stream_target"] = turbo_stream_target
4747

48-
if form.errors and partial_template and turbo_stream_target:
48+
if form.errors and turbo_stream_template and turbo_stream_target:
4949
return (
5050
TurboStream(turbo_stream_target)
5151
.action(turbo_stream_action)
52-
.template(partial_template, context)
52+
.template(turbo_stream_template, context)
5353
.response(request)
5454
)
5555

src/turbo_response/tests/test_shortcuts.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,21 +34,21 @@ class TestRenderFormResponse:
3434
class MyForm(forms.Form):
3535
comment = forms.CharField()
3636

37-
def test_render_partial_no_errors(self, rf):
37+
def test_render_turbo_stream_no_errors(self, rf):
3838
req = rf.get("/")
3939
form = self.MyForm()
4040
resp = render_form_response(
4141
req,
4242
form,
4343
"my_form.html",
4444
turbo_stream_target="my-form",
45-
partial_template="_my_form.html",
45+
turbo_stream_template="_my_form.html",
4646
)
4747
assert resp.status_code == http.HTTPStatus.OK
4848
assert resp.context_data["form"] == form
4949
assert resp.context_data["turbo_stream_target"] == "my-form"
5050

51-
def test_render_partial_errors(self, rf):
51+
def test_render_turbo_stream_errors(self, rf):
5252
req = rf.get("/")
5353
form = self.MyForm({})
5454
# missing comment, should be error
@@ -59,7 +59,7 @@ def test_render_partial_errors(self, rf):
5959
form,
6060
"my_form.html",
6161
turbo_stream_target="my-form",
62-
partial_template="_my_form.html",
62+
turbo_stream_template="_my_form.html",
6363
)
6464
assert resp.status_code == http.HTTPStatus.OK
6565
assert resp.context_data["form"] == form

0 commit comments

Comments
 (0)