ScoDoc/app/views/user_board.py

40 lines
1.1 KiB
Python

"""
Tableau de bord utilisateur
Emmanuel Viennet, 2023
"""
from flask import flash, redirect, render_template, url_for
from flask import g, request
from app.auth.models import User
from app.decorators import (
scodoc,
permission_required,
)
from app.models import FormSemestre
from app.scodoc.sco_permissions import Permission
from app.scodoc import sco_utils as scu
from app.views import scolar_bp as bp
from app.views import ScoData
@bp.route("/user_board/<string:user_name>")
@scodoc
@permission_required(Permission.ScoView)
def user_board(user_name: str):
"""Tableau de bord utilisateur: liens vers ses objets"""
user = User.query.filter_by(user_name=user_name).first_or_404()
formsemestres, modimpls_by_formsemestre = FormSemestre.get_user_formsemestres_annee(
user
)
# TODO: le calendrier avec ses enseignements
return render_template(
"user_board/user_board.j2",
formsemestres=formsemestres,
modimpls_by_formsemestre=modimpls_by_formsemestre,
sco=ScoData(),
title=f"{user.get_prenomnom()}: tableau de bord",
user=user,
)