EditionPN/app/routes.py

59 lines
1.9 KiB
Python
Raw Normal View History

2021-05-06 10:26:28 +02:00
from flask import render_template, flash, redirect, url_for, request
from app import app
from app.forms import *
from app.models import PN
import yaml
@app.route("/")
@app.route("/index")
def index():
return render_template("base.html")
@app.route("/PN", methods=["GET","POST"])
def PN():
form = PNForm()
form_validation = form.validate_on_submit()
form = form_import(form)
if form_validation and form.exporter.data:
flash("Ajout du référentiel PN: {} ".format(form.code.data))
form_export(form)
return redirect(url_for("PN"))
return render_template("PN.html", form = form)
@app.route("/AC", methods=["GET","POST"])
def AC():
return render_template("PN.html", form = form)
@app.route("/SAE", methods=["GET","POST"])
def SAE():
form = SAEForm()
form_validation = form.validate_on_submit()
form = form_import(form)
if form_validation and form.exporter.data:
flash("Ajout du référentiel SAE: {} ".format(form.code.data))
form_export(form)
return redirect(url_for("SAE"))
return render_template("SAE.html", form = form)
@app.route("/Ressource", methods=["GET","POST"])
def Ressource():
form = RessourceForm()
form_validation = form.validate_on_submit()
form = form_import(form)
if form_validation and form.exporter.data:
flash("Ajout du référentiel Ressource: {} ".format(form.code.data))
form_export(form)
return redirect(url_for("Ressource"))
return render_template("Ressource.html", form = form)
@app.route("/Competence", methods=["GET","POST"])
def Competence():
form = CompetenceForm()
form_validation = form.validate_on_submit()
form = form_import(form)
if form_validation and form.exporter.data:
flash("Ajout du référentielCompetence: {} ".format(form.code.data))
form_export(form)
return redirect(url_for("Competence"))
return render_template("Competence.html", form = form)