diff --git a/advlabdb/modelViews.py b/advlabdb/modelViews.py index fa4e30e..b99fc1f 100644 --- a/advlabdb/modelViews.py +++ b/advlabdb/modelViews.py @@ -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), diff --git a/advlabdb/routes.py b/advlabdb/routes.py index 4a5e935..8863c6c 100644 --- a/advlabdb/routes.py +++ b/advlabdb/routes.py @@ -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") diff --git a/advlabdb/templates/index.html b/advlabdb/templates/index.html index da9e131..a05b433 100644 --- a/advlabdb/templates/index.html +++ b/advlabdb/templates/index.html @@ -2,8 +2,4 @@ {% extends "layout.html" %} {% block content %} Welcome to AdvLabDB! - -
- -Go to /admin {% endblock content %}