From 38df53d73ae4102e560e1310635062425667ac80 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BE=9D=E7=91=AA=E8=B2=93?= Date: Sun, 16 Aug 2020 10:39:20 +0800 Subject: [PATCH] Renamed the do_get() method to get(), and do_post() method to post(), and accepts the parameters as dispatch() in the FormView in the Mia core application. --- mia_core/views.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/mia_core/views.py b/mia_core/views.py index 2d21cc0..87cf5e0 100644 --- a/mia_core/views.py +++ b/mia_core/views.py @@ -63,11 +63,11 @@ class FormView(View): def dispatch(self, request: HttpRequest, *args, **kwargs) -> HttpResponse: """The view to store an accounting transaction.""" if self.request.method != "POST": - return self.do_get() + return self.get(request, *args, **kwargs) else: - return self.do_post() + return self.post(request, *args, **kwargs) - def do_get(self) -> HttpResponse: + def get(self, request: HttpRequest, *args, **kwargs) -> HttpResponse: """Handles the GET requests.""" obj = self.get_object() previous_post = stored_post.get_previous_post(self.request) @@ -81,7 +81,8 @@ class FormView(View): self.context_object_name: form }) - def do_post(self) -> HttpResponseRedirect: + def post(self, request: HttpRequest, *args, + **kwargs) -> HttpResponseRedirect: """Handles the POST requests.""" obj = self.get_object() post = self.request.POST.dict()