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:
parent
843e1f5b47
commit
1787a84d30
1 changed files with 8 additions and 5 deletions
|
@ -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,8 +331,11 @@ class GroupView(SecureModelView):
|
||||||
return model
|
return model
|
||||||
|
|
||||||
def update_model(self, form, model):
|
def update_model(self, form, model):
|
||||||
|
try:
|
||||||
Group.check(form.part_students.data, model.program)
|
Group.check(form.part_students.data, model.program)
|
||||||
|
except Exception as ex:
|
||||||
|
flash(str(ex), "error")
|
||||||
|
else:
|
||||||
return super().update_model(form, model)
|
return super().update_model(form, model)
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue