Renamed the form property to form_class in the Mia core application.

This commit is contained in:
依瑪貓 2020-08-16 09:50:05 +08:00
parent de924efda0
commit a2a47cdea2
2 changed files with 6 additions and 6 deletions

View File

@ -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.")

View File

@ -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.")