1
0
Fork 0
mirror of https://codeberg.org/Mo8it/AdvLabDB.git synced 2024-12-20 23:41:20 +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, setUserActiveSemester,
userActiveSemester, userActiveSemester,
) )
from advlabdb.exceptions import ModelViewException from advlabdb.exceptions import ModelViewException, DataBaseException
class UserView(SecureModelView): class UserView(SecureModelView):
@ -288,7 +288,7 @@ class PartStudentView(SecureModelView):
return form(get_form_data(), obj=obj) return form(get_form_data(), obj=obj)
def on_model_change(self, form, model, is_created): 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): def update_model(self, form, model):
if form.final_part_mark.data == -1: if form.final_part_mark.data == -1:
@ -331,9 +331,12 @@ class GroupView(SecureModelView):
return model return model
def update_model(self, form, model): def update_model(self, form, model):
Group.check(form.part_students.data, model.program) try:
Group.check(form.part_students.data, model.program)
return super().update_model(form, model) except Exception as ex:
flash(str(ex), "error")
else:
return super().update_model(form, model)
class ExperimentView(SecureModelView): class ExperimentView(SecureModelView):