Blame view

app/main/routes.py 845 Bytes
8bd0f3cb   hitier   Fix #25: Flask Bl...
1
2
3
4
from flask import render_template

from . import bp

3dae0d18   hitier   Projects list
5
from app.models import Agent, Project
d6836d5e   hitier   Agents list
6

8bd0f3cb   hitier   Fix #25: Flask Bl...
7
8
9

@bp.route('/')
def index():
d6836d5e   hitier   Agents list
10
11
12
    return render_template('index.html',  subtitle="Page d'accueil")


3dae0d18   hitier   Projects list
13
14
15
16
17
18
19
20
21
@bp.route('/projects')
def projects():
    # get projects list
    all_projects = Project.query.order_by(Project.name).all()
    num_projects = len(all_projects)
    # pass to template
    return render_template('projects.html',  subtitle="Liste des projets ({})".format(num_projects),
                           projects=all_projects)

d6836d5e   hitier   Agents list
22
23
24
25
26
27
28
29
@bp.route('/agents')
def agents():
    # get agents list
    all_agents = Agent.query.order_by(Agent.firstname).all()
    num_agents = len(all_agents)
    # pass to template
    return render_template('agents.html',  subtitle="Liste des agents ({})".format(num_agents),
                           agents=all_agents)