From 34d8010cb3bc3e2839922e652aef8e27607ec146 Mon Sep 17 00:00:00 2001 From: Eric Newcomer Date: Mon, 25 Nov 2024 12:55:01 -0800 Subject: [PATCH 1/2] Smartmin doesn't concern itself with formax --- smartmin/views.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/smartmin/views.py b/smartmin/views.py index 7e3a5c7..279d185 100644 --- a/smartmin/views.py +++ b/smartmin/views.py @@ -1094,12 +1094,9 @@ def form_valid(self, form): self.object = self.post_save(self.object) messages.success(self.request, self.derive_success_message()) - if "HTTP_X_FORMAX" not in self.request.META: - return HttpResponseRedirect(self.get_success_url()) - else: - response = self.render_to_response(self.get_context_data(form=form)) - response["REDIRECT"] = self.get_success_url() - return response + response = self.render_to_response(self.get_context_data(form=form)) + response["REDIRECT"] = self.get_success_url() + return response except IntegrityError as e: message = str(e).capitalize() From f406b137c612bf9e8b5d9f051305fc85f695867d Mon Sep 17 00:00:00 2001 From: Eric Newcomer Date: Mon, 25 Nov 2024 13:15:41 -0800 Subject: [PATCH 2/2] Invert non-formax behavior --- smartmin/views.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/smartmin/views.py b/smartmin/views.py index 279d185..ae137ff 100644 --- a/smartmin/views.py +++ b/smartmin/views.py @@ -1094,9 +1094,7 @@ def form_valid(self, form): self.object = self.post_save(self.object) messages.success(self.request, self.derive_success_message()) - response = self.render_to_response(self.get_context_data(form=form)) - response["REDIRECT"] = self.get_success_url() - return response + return HttpResponseRedirect(self.get_success_url()) except IntegrityError as e: message = str(e).capitalize()