mirror of
https://codeberg.org/Mo8it/AdvLabDB.git
synced 2024-12-20 23:41:20 +00:00
Remvoed unnecessary check in GroupView
This commit is contained in:
parent
ab1eded4b7
commit
03edae883f
1 changed files with 4 additions and 12 deletions
|
@ -362,8 +362,8 @@ def partStudentQueryFactory():
|
|||
|
||||
|
||||
class GroupView(SecureAdminModelView):
|
||||
def formFactory(create, group):
|
||||
if create:
|
||||
def formFactory(is_created, group):
|
||||
if is_created:
|
||||
|
||||
def query_factory():
|
||||
return partStudentQueryFactory().filter(PartStudent.group == None)
|
||||
|
@ -397,20 +397,12 @@ class GroupView(SecureAdminModelView):
|
|||
def customCreateModel(self, form):
|
||||
return Group.customInit(form.part_students.data)
|
||||
|
||||
def update_model(self, form, model):
|
||||
try:
|
||||
Group.check(form.part_students.data, model.program)
|
||||
except Exception as ex:
|
||||
flash(str(ex), "error")
|
||||
else:
|
||||
return super().update_model(form, model)
|
||||
|
||||
def create_form(self, obj=None):
|
||||
form = GroupView.formFactory(create=True, group=None)
|
||||
form = GroupView.formFactory(is_created=True, group=None)
|
||||
return form(get_form_data(), obj=obj)
|
||||
|
||||
def edit_form(self, obj=None):
|
||||
form = GroupView.formFactory(create=False, group=obj)
|
||||
form = GroupView.formFactory(is_created=False, group=obj)
|
||||
return form(get_form_data(), obj=obj)
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue