From 72888d68b621b6c2288d1eb043b2b3768eb52c02 Mon Sep 17 00:00:00 2001 From: Horilla Date: Sat, 2 Aug 2025 12:21:28 +0530 Subject: [PATCH] [UPDT] HORILLA_VIEWS: Updated HorillaFormView class get_context_data function by adding hx_target in context --- horilla_views/generic/cbv/views.py | 1 + .../templates/generic/horilla_form.html | 146 +++++++++--------- 2 files changed, 71 insertions(+), 76 deletions(-) diff --git a/horilla_views/generic/cbv/views.py b/horilla_views/generic/cbv/views.py index 225ed2c75..5b7053c2d 100644 --- a/horilla_views/generic/cbv/views.py +++ b/horilla_views/generic/cbv/views.py @@ -1898,6 +1898,7 @@ class HorillaFormView(FormView): context["form_class_path"] = self.form_class_path context["view_id"] = self.view_id context["hx_confirm"] = self.hx_confirm + context["hx_target"] = self.request.META.get("HTTP_HX_TARGET", "this") pk = None if self.form.instance: pk = self.form.instance.pk diff --git a/horilla_views/templates/generic/horilla_form.html b/horilla_views/templates/generic/horilla_form.html index 1c921f97f..c39f9e47b 100644 --- a/horilla_views/templates/generic/horilla_form.html +++ b/horilla_views/templates/generic/horilla_form.html @@ -1,80 +1,74 @@ {% load generic_template_filters %} -
- {% for field_tuple in dynamic_create_fields %} - -
- {% endfor %} -
{{form.structured}}
- {% for field_tuple in dynamic_create_fields %} -
- - - {% endfor %}
+ +
+ {{ form.structured }} +
+ +{% for field_tuple in dynamic_create_fields %} +
+ + + + + +
+{% endfor %}