forked from ScoDoc/ScoDoc
commencement du choix de format de retour pour le bulletin d'un étudiant
This commit is contained in:
parent
2cc1ab13d3
commit
d06b11eb4c
@ -11,6 +11,8 @@ from app.api.tools import get_etu_from_etudid_or_nip_or_ine
|
|||||||
from app.models import FormSemestreInscription, FormSemestre, Identite
|
from app.models import FormSemestreInscription, FormSemestre, Identite
|
||||||
from app.scodoc import sco_bulletins
|
from app.scodoc import sco_bulletins
|
||||||
from app.scodoc import sco_groups
|
from app.scodoc import sco_groups
|
||||||
|
from app.scodoc.sco_bulletins import do_formsemestre_bulletinetud
|
||||||
|
from app.scodoc.sco_bulletins_pdf import get_etud_bulletins_pdf
|
||||||
from app.scodoc.sco_permissions import Permission
|
from app.scodoc.sco_permissions import Permission
|
||||||
|
|
||||||
|
|
||||||
@ -168,32 +170,62 @@ def etudiant_formsemestres(etudid: int = None, nip: int = None, ine: int = None)
|
|||||||
@bp.route(
|
@bp.route(
|
||||||
"/etudiant/etudid/<int:etudid>/formsemestre/<int:formsemestre_id>/bulletin",
|
"/etudiant/etudid/<int:etudid>/formsemestre/<int:formsemestre_id>/bulletin",
|
||||||
methods=["GET"],
|
methods=["GET"],
|
||||||
defaults={"version": "long"},
|
defaults={"version": "long", "format": "json"},
|
||||||
)
|
)
|
||||||
@bp.route(
|
@bp.route(
|
||||||
"/etudiant/nip/<int:nip>/formsemestre/<int:formsemestre_id>/bulletin",
|
"/etudiant/nip/<int:nip>/formsemestre/<int:formsemestre_id>/bulletin",
|
||||||
methods=["GET"],
|
methods=["GET"],
|
||||||
defaults={"version": "long"},
|
defaults={"version": "long", "format": "json"},
|
||||||
)
|
)
|
||||||
@bp.route(
|
@bp.route(
|
||||||
"/etudiant/ine/<int:ine>/formsemestre/<int:formsemestre_id>/bulletin",
|
"/etudiant/ine/<int:ine>/formsemestre/<int:formsemestre_id>/bulletin",
|
||||||
methods=["GET"],
|
methods=["GET"],
|
||||||
defaults={"version": "long"},
|
defaults={"version": "long", "format": "json"},
|
||||||
|
)
|
||||||
|
@bp.route(
|
||||||
|
"/etudiant/etudid/<int:etudid>/formsemestre/<int:formsemestre_id>/bulletin/pdf",
|
||||||
|
methods=["GET"],
|
||||||
|
defaults={"version": "long", "format": "pdf"},
|
||||||
|
)
|
||||||
|
@bp.route(
|
||||||
|
"/etudiant/nip/<int:nip>/formsemestre/<int:formsemestre_id>/bulletin/pdf",
|
||||||
|
methods=["GET"],
|
||||||
|
defaults={"version": "long", "format": "pdf"},
|
||||||
|
)
|
||||||
|
@bp.route(
|
||||||
|
"/etudiant/ine/<int:ine>/formsemestre/<int:formsemestre_id>/bulletin/pdf",
|
||||||
|
methods=["GET"],
|
||||||
|
defaults={"version": "long", "format": "pdf"},
|
||||||
)
|
)
|
||||||
@bp.route(
|
@bp.route(
|
||||||
"/etudiant/etudid/<int:etudid>/formsemestre/<int:formsemestre_id>/bulletin/short",
|
"/etudiant/etudid/<int:etudid>/formsemestre/<int:formsemestre_id>/bulletin/short",
|
||||||
methods=["GET"],
|
methods=["GET"],
|
||||||
defaults={"version": "short"},
|
defaults={"version": "short", "format": "json"},
|
||||||
)
|
)
|
||||||
@bp.route(
|
@bp.route(
|
||||||
"/etudiant/nip/<int:nip>/formsemestre/<int:formsemestre_id>/bulletin/short",
|
"/etudiant/nip/<int:nip>/formsemestre/<int:formsemestre_id>/bulletin/short",
|
||||||
methods=["GET"],
|
methods=["GET"],
|
||||||
defaults={"version": "short"},
|
defaults={"version": "short", "format": "json"},
|
||||||
)
|
)
|
||||||
@bp.route(
|
@bp.route(
|
||||||
"/etudiant/ine/<int:ine>/formsemestre/<int:formsemestre_id>/bulletin/short",
|
"/etudiant/ine/<int:ine>/formsemestre/<int:formsemestre_id>/bulletin/short",
|
||||||
methods=["GET"],
|
methods=["GET"],
|
||||||
defaults={"version": "short"},
|
defaults={"version": "short", "format": "json"},
|
||||||
|
)
|
||||||
|
@bp.route(
|
||||||
|
"/etudiant/etudid/<int:etudid>/formsemestre/<int:formsemestre_id>/bulletin/short/pdf",
|
||||||
|
methods=["GET"],
|
||||||
|
defaults={"version": "short", "format": "pdf"},
|
||||||
|
)
|
||||||
|
@bp.route(
|
||||||
|
"/etudiant/nip/<int:nip>/formsemestre/<int:formsemestre_id>/bulletin/short/pdf",
|
||||||
|
methods=["GET"],
|
||||||
|
defaults={"version": "short", "format": "pdf"},
|
||||||
|
)
|
||||||
|
@bp.route(
|
||||||
|
"/etudiant/ine/<int:ine>/formsemestre/<int:formsemestre_id>/bulletin/short/pdf",
|
||||||
|
methods=["GET"],
|
||||||
|
defaults={"version": "short", "format": "pdf"},
|
||||||
)
|
)
|
||||||
@token_auth.login_required
|
@token_auth.login_required
|
||||||
@token_permission_required(Permission.APIView)
|
@token_permission_required(Permission.APIView)
|
||||||
@ -203,6 +235,7 @@ def etudiant_bulletin_semestre(
|
|||||||
nip: int = None,
|
nip: int = None,
|
||||||
ine: int = None,
|
ine: int = None,
|
||||||
version="long",
|
version="long",
|
||||||
|
format="json",
|
||||||
):
|
):
|
||||||
"""
|
"""
|
||||||
Retourne le bulletin d'un étudiant en fonction de son id et d'un semestre donné
|
Retourne le bulletin d'un étudiant en fonction de son id et d'un semestre donné
|
||||||
@ -397,8 +430,14 @@ def etudiant_bulletin_semestre(
|
|||||||
message="La requête ne peut être traitée en l’état actuel.\n "
|
message="La requête ne peut être traitée en l’état actuel.\n "
|
||||||
"Veuillez vérifier que l'id de l'étudiant (etudid, nip, ine) est valide",
|
"Veuillez vérifier que l'id de l'étudiant (etudid, nip, ine) est valide",
|
||||||
)
|
)
|
||||||
|
if format == "json":
|
||||||
return sco_bulletins.get_formsemestre_bulletin_etud_json(formsemestre, etu, version)
|
return sco_bulletins.get_formsemestre_bulletin_etud_json(
|
||||||
|
formsemestre, etu, version
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
etudid = etu.id
|
||||||
|
print(etudid)
|
||||||
|
return do_formsemestre_bulletinetud(formsemestre, etudid, version, format)
|
||||||
|
|
||||||
|
|
||||||
@bp.route(
|
@bp.route(
|
||||||
|
Loading…
Reference in New Issue
Block a user