Refactor NormalCaseForm to prevent nested forms and enhance logging in case_normal_form and create_case_normal views
This commit is contained in:
+6
-1
@@ -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"),
|
||||
|
||||
Reference in New Issue
Block a user