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

Fixed active semester not found

This commit is contained in:
Mo 2021-04-24 14:01:14 +02:00
parent ff0f5cc48c
commit c86091fe39
2 changed files with 7 additions and 2 deletions

View file

@ -10,6 +10,7 @@ class SecureAdminIndexView(AdminIndexView):
class SecureModelView(ModelView): class SecureModelView(ModelView):
can_export = True can_export = True
can_set_page_size = True
def is_accessible(self): def is_accessible(self):
return current_user.has_role("admin") return current_user.has_role("admin")

View file

@ -23,8 +23,12 @@ def util_processor():
if "activeSemesterId" not in session: if "activeSemesterId" not in session:
session["activeSemesterId"] = lastSemesterId session["activeSemesterId"] = lastSemesterId
elif session["activeSemesterId"] != lastSemesterId: elif session["activeSemesterId"] != lastSemesterId:
flash(f"You are in the old semester {Semester.query.get(session['activeSemesterId']).label}!", activeSemester = Semester.query.get(session['activeSemesterId'])
"warning") if activeSemester:
flash(f"You are in the old semester {activeSemester.label}!", "warning")
else:
flash(f"Semester changed!", "warning")
session["activeSemesterId"] = lastSemesterId
return Semester.query.get(session["activeSemesterId"]).label return Semester.query.get(session["activeSemesterId"]).label
def navbarItems(title): def navbarItems(title):