forked from ScoDoc/ScoDoc
Merge branch 'new_api' of https://scodoc.org/git/viennet/ScoDoc
This commit is contained in:
commit
c5904d75a8
@ -16,15 +16,32 @@ def departements():
|
||||
"""
|
||||
Retourne la liste des ids de départements visibles
|
||||
|
||||
Exemple de résultat : [2, 5, 8, 1, 4, 18]
|
||||
Exemple de résultat :
|
||||
[
|
||||
{
|
||||
"id": 1,
|
||||
"acronym": "TAPI",
|
||||
"description": null,
|
||||
"visible": true,
|
||||
"date_creation": "Fri, 15 Apr 2022 12:19:28 GMT"
|
||||
},
|
||||
{
|
||||
"id": 2,
|
||||
"acronym": "MMI",
|
||||
"description": null,
|
||||
"visible": false,
|
||||
"date_creation": "Fri, 18 Apr 2022 11:20:8 GMT"
|
||||
},
|
||||
...
|
||||
]
|
||||
"""
|
||||
# Récupération de tous les départements
|
||||
depts = models.Departement.query.filter_by(visible=True)
|
||||
depts = models.Departement.query.all()
|
||||
|
||||
# Mise en place de la liste avec tous les ids de départements
|
||||
depts_ids = [d.id for d in depts]
|
||||
# Mise en place de la liste avec tous les départements
|
||||
data = [d.to_dict() for d in depts]
|
||||
|
||||
return jsonify(depts_ids)
|
||||
return jsonify(data)
|
||||
|
||||
|
||||
@bp.route("/departements/<string:dept>/etudiants/liste", methods=["GET"])
|
||||
|
Loading…
Reference in New Issue
Block a user