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

60 lines
2.2 KiB
Python

from advlabdb import app
from flask import render_template, request, url_for
from advlabdb.utils import *
from advlabdb.models import *
@app.route("/")
def index():
page = "index"
return render_template(page + ".html", navbarItems=navbarItems(page))
@app.route("/students")
def students():
parts = Semester.query.all()[-1].parts
tables = []
tablesLabels = []
headerAndDataList = [["Student number", "row.student.student_number"],
["First name", "row.student.first_name"],
["Last name", "row.student.last_name"],
["Email", "row.student.email"],
["Bachelor thesis", "row.student.bachelor_thesis"],
["BT WG", "row.student.bachelor_thesis_work_group"],
["Note", "row.student.note"],
["Parts", "[ps.part for ps in row.student.part_students]"],
["Final part mark", "row.final_part_mark"],
["GN", "row.group.number"],
["Experiemt marks", "row.experiment_marks"]]
for part in parts:
tablesLabels.append("Part " + part.label + ":")
tables.append(makeTable(headerAndDataList=headerAndDataList,
rows=part.part_students))
page = "students"
return render_template(page + ".html", navbarItems=navbarItems(page),
tables=tables, tablesLabels=tablesLabels)
@app.route("/assistants")
def assistants():
page = "assistants"
return render_template(page + ".html", navbarItems=navbarItems(page))
@app.route("/experiments")
def experiments():
page = "experiments"
return render_template(page + ".html", navbarItems=navbarItems(page))
@app.route("/appointments")
def appointments():
page = "appointments"
return render_template(page + ".html", navbarItems=navbarItems(page))
@app.route("/groups")
def groups():
page = "groups"
return render_template(page + ".html", navbarItems=navbarItems(page))
@app.route("/users")
def users():
page = "users"
return render_template(page + ".html", navbarItems=navbarItems(page))