From 5d852a09b2da4ee555599adf3d5973e57932a9ca Mon Sep 17 00:00:00 2001 From: Sebastien Renard Date: Sat, 19 Oct 2024 18:19:04 +0200 Subject: [PATCH] only reload contact-tab content when submiting form --- staffing/views.py | 1 - templates/staffing/mission_contacts.html | 14 +++++++++++--- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/staffing/views.py b/staffing/views.py index ff34107e..fa5e2a24 100644 --- a/staffing/views.py +++ b/staffing/views.py @@ -1867,7 +1867,6 @@ def mission_contacts(request, mission_id): form = MissionContactsForm(request.POST, instance=mission) if form.is_valid(): form.save() - return HttpResponseRedirect(reverse("staffing:mission_home", args=[mission.id, ])) # Unbound form form = MissionContactsForm(instance=mission) diff --git a/templates/staffing/mission_contacts.html b/templates/staffing/mission_contacts.html index 38d50b2e..031487cc 100644 --- a/templates/staffing/mission_contacts.html +++ b/templates/staffing/mission_contacts.html @@ -2,6 +2,10 @@ {# of a page loaded in ajax #} {% load i18n %} +
+
-
+ {{ mission_contact_form.non_field_errors }} {{ mission_contact_form }} - +

{% trans "New mission contact" %} @@ -51,5 +57,7 @@

$(document).ready(function() { $('#contact_edit').hide(); + htmx.process(document.body); }); +

\ No newline at end of file