Enhance ConditionForm: add Crispy Forms integration for consistent submit button rendering
This commit is contained in:
@@ -131,6 +131,18 @@ class ConditionForm(ModelForm):
|
|||||||
),
|
),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def __init__(self, *args, **kwargs):
|
||||||
|
super().__init__(*args, **kwargs)
|
||||||
|
# Crispy helper to render a submit button consistently
|
||||||
|
try:
|
||||||
|
self.helper = FormHelper()
|
||||||
|
self.helper.form_method = "post"
|
||||||
|
self.helper.form_tag = True
|
||||||
|
self.helper.add_input(Submit("submit", "Submit"))
|
||||||
|
except Exception:
|
||||||
|
# If crispy not available or something goes wrong, don't break form
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
class CaseCollectionForm(ModelForm):
|
class CaseCollectionForm(ModelForm):
|
||||||
class Meta:
|
class Meta:
|
||||||
|
|||||||
Reference in New Issue
Block a user