Revised the fill_model_from_form() method in the FormView in the Mia core application.

This commit is contained in:
依瑪貓 2020-08-13 22:33:31 +08:00
parent 7d364da930
commit 95b6a6a4ea

View File

@ -151,8 +151,8 @@ class FormView(View):
def fill_model_from_form(self, obj: Model, form: forms.Form) -> None: def fill_model_from_form(self, obj: Model, form: forms.Form) -> None:
"""Fills in the data model from the form.""" """Fills in the data model from the form."""
for name in form.data.keys(): for name in form.fields:
setattr(obj, name, form.data[name]) setattr(obj, name, form[name].value())
def get_error_url(self) -> str: def get_error_url(self) -> str:
"""Returns the URL on error.""" """Returns the URL on error."""