Refactor NormalCaseForm to prevent nested forms and enhance logging in case_normal_form and create_case_normal views

This commit is contained in:
Ross
2025-11-13 22:13:46 +00:00
parent f8be1918f6
commit 970242e1fb
2 changed files with 19 additions and 1 deletions
+6 -1
View File
@@ -246,8 +246,13 @@ class NormalCaseForm(ModelForm):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.helper = FormHelper()
# Do not render a <form> tag from crispy here because the template
# already provides the surrounding form element (we inject this
# fragment into a modal that contains the form). Rendering a second
# <form> would nest forms and cause fields to be outside the
# submitted form (HTMX would only send the outer form's fields).
self.helper.form_method = "post"
self.helper.form_tag = True
self.helper.form_tag = False
self.helper.layout = Layout(
Div(
Field("age_years", wrapper_class="col-md-4"),