Commit 6cbf4b7548eec1276bef5856dc70e4b1a85bcee4
1 parent
cbe1461d
Exists in
master
and in
4 other branches
Periods list
Showing
3 changed files
with
29 additions
and
3 deletions
Show diff stats
app/main/routes.py
... | ... | @@ -2,7 +2,7 @@ from flask import render_template |
2 | 2 | |
3 | 3 | from . import bp |
4 | 4 | |
5 | -from app.models import Agent, Project, Service, Capacity | |
5 | +from app.models import Agent, Project, Service, Capacity, Period | |
6 | 6 | |
7 | 7 | |
8 | 8 | @bp.route('/') |
... | ... | @@ -16,7 +16,7 @@ def services(): |
16 | 16 | all_services = Service.query.order_by(Service.name).all() |
17 | 17 | num_services = len(all_services) |
18 | 18 | # pass to template |
19 | - return render_template('services.html', subtitle="Liste des projets ({})".format(num_services), | |
19 | + return render_template('services.html', subtitle="Liste des services ({})".format(num_services), | |
20 | 20 | services=all_services) |
21 | 21 | |
22 | 22 | |
... | ... | @@ -47,3 +47,12 @@ def capacities(): |
47 | 47 | # pass to template |
48 | 48 | return render_template('capacities.html', subtitle="Liste des fonctions ({})".format(num_capacities), |
49 | 49 | capacities=all_capacities) |
50 | + | |
51 | +@bp.route('/periods') | |
52 | +def periods(): | |
53 | + # get capacities list | |
54 | + all_periods = Period.query.order_by(Period.name).all() | |
55 | + num_periods = len(all_periods) | |
56 | + # pass to template | |
57 | + return render_template('periods.html', subtitle="Liste des périodes ({})".format(num_periods), | |
58 | + periods=all_periods) | ... | ... |
... | ... | @@ -0,0 +1,17 @@ |
1 | +{% extends "base_page.html" %} | |
2 | +{% block content %} | |
3 | +<table class="table table-hover"> | |
4 | + <thead> | |
5 | + <tr> | |
6 | + <th scope="col">Période</th> | |
7 | + </tr> | |
8 | + </thead> | |
9 | + <tbody> | |
10 | + {% for period in periods %} | |
11 | + <tr> | |
12 | + <td>{{ period.name }}</td> | |
13 | + </tr> | |
14 | + {% endfor %} | |
15 | + </tbody> | |
16 | +</table> | |
17 | +{% endblock %} | ... | ... |
app/templates/base_page.html
... | ... | @@ -100,7 +100,7 @@ |
100 | 100 | <li><a class=" disabled" href="#">Nouvelle responsabilité</a></li> |
101 | 101 | <li><a class=" disabled" href="#">Affecter un responsable de projet</a></li> |
102 | 102 | <li><a class=" disabled" href="#">Affecter un responsable de service</a></li> |
103 | - <li><a class=" " href="#">Liste des semestres</a></li> | |
103 | + <li><a class=" " href="{{url_for('main.periods')}}">Liste des périodes</a></li> | |
104 | 104 | <li><a class=" disabled" href="#">Nouveau semestre</a></li> |
105 | 105 | |
106 | 106 | </ul> | ... | ... |