mirror of
https://codeberg.org/Mo8it/AdvLabDB.git
synced 2024-12-04 22:40:30 +00:00
Remove setActiveSemester and its route
This commit is contained in:
parent
c0b0e18332
commit
56cedaa308
2 changed files with 0 additions and 31 deletions
|
@ -689,22 +689,6 @@ class User(db.Model, FsUserMixin):
|
|||
def __str__(self):
|
||||
return self.str()
|
||||
|
||||
def setActiveSemester(self, semester):
|
||||
if semester is None:
|
||||
flash("Can not change the active semester to None!", "error")
|
||||
return
|
||||
|
||||
if self.active_semester != semester:
|
||||
try:
|
||||
self.active_semester = semester
|
||||
db.session.commit()
|
||||
except Exception as ex:
|
||||
flash(str(ex), "error")
|
||||
|
||||
db.session.rollback()
|
||||
else:
|
||||
flash(f"Active semester changed to {semester}!", "warning")
|
||||
|
||||
|
||||
class Role(db.Model, FsRoleMixin):
|
||||
def str(self):
|
||||
|
|
|
@ -31,18 +31,3 @@ def index():
|
|||
url = url_for(endpoint_base + ".index")
|
||||
|
||||
return redirect(url)
|
||||
|
||||
|
||||
@bp.route("/set_semester")
|
||||
@auth_required()
|
||||
def set_semester():
|
||||
try:
|
||||
semesterId = int(request.args.get("semester_id"))
|
||||
except Exception as ex:
|
||||
flash(str(ex), "error")
|
||||
else:
|
||||
semester = db.session.get(Semester, semesterId)
|
||||
current_user.setActiveSemester(semester)
|
||||
|
||||
red = request.referrer or url_for("main.index")
|
||||
return redirect(red)
|
||||
|
|
Loading…
Reference in a new issue