1
0
Fork 0
mirror of https://codeberg.org/Mo8it/AdvLabDB.git synced 2024-09-19 18:31:16 +00:00

Fixed 2 checks

This commit is contained in:
Mo 2021-07-29 21:13:49 +02:00
parent 843e1f5b47
commit 1787a84d30

View file

@ -34,7 +34,7 @@ from advlabdb.utils import (
setUserActiveSemester,
userActiveSemester,
)
from advlabdb.exceptions import ModelViewException
from advlabdb.exceptions import ModelViewException, DataBaseException
class UserView(SecureModelView):
@ -288,7 +288,7 @@ class PartStudentView(SecureModelView):
return form(get_form_data(), obj=obj)
def on_model_change(self, form, model, is_created):
PartStudent.check(model.group, model.group)
PartStudent.check(model.group, model.part)
def update_model(self, form, model):
if form.final_part_mark.data == -1:
@ -331,9 +331,12 @@ class GroupView(SecureModelView):
return model
def update_model(self, form, model):
Group.check(form.part_students.data, model.program)
return super().update_model(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)
class ExperimentView(SecureModelView):