Added type hints to the parameters in the form_invalid and form_valid methods in FormView in the Mia core application.
This commit is contained in:
parent
4f9c3e89c3
commit
eba94c2b96
@ -146,12 +146,12 @@ class FormView(View):
|
|||||||
for name in form.fields:
|
for name in form.fields:
|
||||||
setattr(obj, name, form[name].value())
|
setattr(obj, name, form[name].value())
|
||||||
|
|
||||||
def form_invalid(self, form) -> HttpResponseRedirect:
|
def form_invalid(self, form: forms.Form) -> HttpResponseRedirect:
|
||||||
"""Handles the action when the POST form is invalid"""
|
"""Handles the action when the POST form is invalid"""
|
||||||
return stored_post.error_redirect(
|
return stored_post.error_redirect(
|
||||||
self.request, self.get_error_url(), form.data)
|
self.request, self.get_error_url(), form.data)
|
||||||
|
|
||||||
def form_valid(self, form) -> HttpResponseRedirect:
|
def form_valid(self, form: forms.Form) -> HttpResponseRedirect:
|
||||||
"""Handles the action when the POST form is valid"""
|
"""Handles the action when the POST form is valid"""
|
||||||
obj = self.get_object()
|
obj = self.get_object()
|
||||||
if obj is None:
|
if obj is None:
|
||||||
|
Loading…
Reference in New Issue
Block a user