Use http_methods_allowed attribute
This commit is contained in:
parent
f3dbb72f69
commit
c4948be1f7
2 changed files with 3 additions and 4 deletions
|
@ -359,9 +359,9 @@ class AccountDeleteViewTests(ViewTestCaseMixin, TestCase):
|
|||
"trez": create_user("trez", "#13"),
|
||||
}
|
||||
|
||||
def test_get_redirects(self):
|
||||
def test_get_405(self):
|
||||
r = self.client.get(self.url)
|
||||
self.assertRedirects(r, reverse("kfet.account.read", kwargs=self.url_kwargs))
|
||||
self.assertEqual(r.status_code, 405)
|
||||
|
||||
def test_post_ok(self):
|
||||
r = self.client.post(self.url, {})
|
||||
|
|
|
@ -480,8 +480,7 @@ class AccountDelete(PermissionRequiredMixin, DeleteView):
|
|||
success_message = "Compte supprimé avec succès !"
|
||||
permission_required = "kfet.delete_account"
|
||||
|
||||
def get(self, request, *args, **kwargs):
|
||||
return redirect("kfet.account.read", self.kwargs.get(self.get_slug_field()))
|
||||
http_method_names = ["post"]
|
||||
|
||||
def delete(self, request, *args, **kwargs):
|
||||
self.object = self.get_object()
|
||||
|
|
Loading…
Reference in a new issue