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

Added redirecting after login

This commit is contained in:
Mo 2021-05-17 22:15:50 +02:00
parent ad5b3117fd
commit 810a3ba496
3 changed files with 7 additions and 7 deletions

View file

@ -167,7 +167,7 @@ admin.add_view(UserModelView(User, db.session))
admin.add_view(RoleModelView(Role, db.session))
with app.app_context():
semesters = Semester.query.all()
semesters = Semester.query.all()[::-1]
for semester in semesters:
admin.add_link(MenuLink(name=semester.label,
url=url_for("set_semester") + "?semester_id=" + str(semester.id),

View file

@ -56,8 +56,12 @@ def util_processor():
@app.route("/")
def index():
return render_template("index.html",
)
if current_user.has_role("admin"):
return redirect(url_for("index") + "admin")
elif current_user.has_role("assistant"):
return redirect(url_for("index") + "assistant")
else:
return render_template("index.html")
"""
@app.route("/assistants")

View file

@ -2,8 +2,4 @@
{% extends "layout.html" %}
{% block content %}
Welcome to AdvLabDB!
<br>
Go to <a href="{{url_for("index") + "admin"}}" style="font-size:40px">/admin</a>
{% endblock content %}