diff --git a/accounting/views.py b/accounting/views.py index 5b2a7f6..e7572c0 100644 --- a/accounting/views.py +++ b/accounting/views.py @@ -985,7 +985,7 @@ class AccountView(DetailView): class AccountFormView(FormView): """The form to create or update an account.""" model = Account - form = AccountForm + form_class = AccountForm not_modified_message = gettext_noop("This account was not modified.") success_message = gettext_noop("This account was saved successfully.") diff --git a/mia_core/views.py b/mia_core/views.py index 1b1c8a4..78ec6e1 100644 --- a/mia_core/views.py +++ b/mia_core/views.py @@ -47,7 +47,7 @@ from .utils import UrlBuilder class FormView(View): """The base form view.""" model: Type[Model] = None - form: Type[forms.Form] = None + form_class: Type[forms.Form] = None template_name: str = None context_object_name: str = "form" success_url: str = None @@ -106,9 +106,9 @@ class FormView(View): @property def _form(self): - if self.form is None: - raise AttributeError("Please defined the form property.") - return self.form + if self.form_class is None: + raise AttributeError("Please defined the form_class property.") + return self.form_class @property def _model(self): @@ -236,7 +236,7 @@ class UserView(DetailView): class UserFormView(FormView): """The form to create or update a user.""" model = User - form = UserForm + form_class = UserForm not_modified_message = gettext_noop("This user account was not changed.") success_message = gettext_noop("This user account was saved successfully.")