mirror of
https://codeberg.org/Mo8it/AdvLabDB.git
synced 2024-12-20 23:41:20 +00:00
Use session.get
This commit is contained in:
parent
ec3664a30a
commit
d2a0700f7d
2 changed files with 6 additions and 6 deletions
|
@ -1194,7 +1194,7 @@ class AppointmentView(SecureAdminModelView):
|
|||
class ExperimentMarkView(SecureAdminModelView):
|
||||
class StudentFilter(FilterEqual):
|
||||
def validate(self, value):
|
||||
if Student.query.get(value):
|
||||
if db.session.get(Student, value) is not None:
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
|
|
|
@ -20,8 +20,8 @@ def userActiveSemester(flashWarning=False):
|
|||
current_user.active_semester_id = lastSemesterId
|
||||
db.session.commit()
|
||||
elif current_user.active_semester_id != lastSemesterId:
|
||||
activeSemester = Semester.query.get(current_user.active_semester_id)
|
||||
if activeSemester:
|
||||
activeSemester = db.session.get(Semester, current_user.active_semester_id)
|
||||
if activeSemester is not None:
|
||||
if flashWarning:
|
||||
flash(f"You are in the old semester {activeSemester.repr()}!", "warning")
|
||||
else:
|
||||
|
@ -29,13 +29,13 @@ def userActiveSemester(flashWarning=False):
|
|||
db.session.commit()
|
||||
flash("Semester changed!", "warning")
|
||||
|
||||
return Semester.query.get(current_user.active_semester_id)
|
||||
return db.session.get(Semester, current_user.active_semester_id)
|
||||
|
||||
|
||||
def setUserActiveSemester(semesterId):
|
||||
if current_user.active_semester_id != semesterId:
|
||||
semester = Semester.query.get(semesterId)
|
||||
if semester:
|
||||
semester = db.session.get(Semester, semesterId)
|
||||
if semester is not None:
|
||||
try:
|
||||
current_user.active_semester_id = semesterId
|
||||
db.session.commit()
|
||||
|
|
Loading…
Reference in a new issue