Self hosted FLOSS fitness/workout, nutrition and weight tracker
Correctly set the form action
Roland Geidera427a255b513
diff --git a/docs/changelog.rst b/docs/changelog.rstindex 2c249fcb4..db08be608 100644--- a/docs/changelog.rst+++ b/docs/changelog.rst@@ -24,7 +24,7 @@ Upgrade steps from 1.9:🐛 Bug Fixes:-* `#499`_, `#505`_, `#504`_, `#511`_+* `#499`_, `#505`_, `#504`_, `#511`_, `#522`_🧰 Maintenance:@@ -50,6 +50,7 @@ Upgrade steps from 1.9:.. _#504: https://github.com/wger-project/wger/issues/504.. _#505: https://github.com/wger-project/wger/issues/505.. _#511: https://github.com/wger-project/wger/issues/511+.. _#522: https://github.com/wger-project/wger/issues/522diff --git a/wger/core/templates/user/delete_account.html b/wger/core/templates/user/delete_account.htmlindex 9285fac6c..b3bcff532 100644--- a/wger/core/templates/user/delete_account.html+++ b/wger/core/templates/user/delete_account.html@@ -24,6 +24,7 @@ It will also irrevocably remove all the data associated with it (workouts, logsand can't be undone. {% endblocktrans %}{% endwith %}</p></div></div>+ <div class="mt-2"></div>{% crispy form %}</div>{% endblock %}diff --git a/wger/core/tests/base_testcase.py b/wger/core/tests/base_testcase.pyindex 6eba016dd..f16e7e61b 100644--- a/wger/core/tests/base_testcase.py+++ b/wger/core/tests/base_testcase.py@@ -247,6 +247,12 @@ class WgerDeleteTestCase(WgerTestCase):count_after = self.object_class.objects.count()self.assertEqual(count_before, count_after)+ # Checks that the forms have the correct CSS class+ # This makes sure they can be used with the current modal dialog logic.+ # Hopefully we will refactor that in the future and then this check can+ # be removed+ self.assertInHTML("wger-form", response)+if fail:self.assertIn(response.status_code, STATUS_CODES_FAIL)else:@@ -274,6 +280,13 @@ class WgerDeleteTestCase(WgerTestCase):# self.assertEqual(response.status_code, 200)self.post_test_hook()+ def test_form_css_class(self):+ """++ """+ self.delete_object(fail=True)++def test_delete_object_anonymous(self):"""Tests deleting the object as an anonymous userdiff --git a/wger/core/views/user.py b/wger/core/views/user.pyindex dc0cae164..32f4d6702 100644--- a/wger/core/views/user.py+++ b/wger/core/views/user.py@@ -160,6 +160,7 @@ def delete(request, user_pk=None):else:gym_pk = request.user.userprofile.gym_idreturn HttpResponseRedirect(reverse('gym:gym:user-list', kwargs={'pk': gym_pk}))+ form.helper.form_action = request.pathcontext = {'form': form,'user_delete': user}