1
0
Fork 0
mirror of https://codeberg.org/Mo8it/AdvLabDB.git synced 2024-11-08 21:21:06 +00:00

Remvoed unnecessary check in GroupView

This commit is contained in:
Mo 2021-08-18 20:11:40 +02:00
parent ab1eded4b7
commit 03edae883f

View file

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