101 lines
3.5 KiB
Python
101 lines
3.5 KiB
Python
from flask import render_template, flash, redirect, url_for, request
|
|
from app import app, db
|
|
from app.forms import *
|
|
import app.models as models
|
|
|
|
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.referentiel.choices = [x for x in models.PN.query.all()]
|
|
form_validation = form.validate_on_submit()
|
|
form = form_import(form)
|
|
form = form_charger(form)
|
|
temp = form_supprimer(form)
|
|
if temp[0] == True: return temp[1]
|
|
else: form = temp[1]
|
|
if form_validation and not form.charger.data:
|
|
if form.exporter.data:
|
|
flash("Ajout du référentiel PN: {} ".format(form.code.data))
|
|
form_export(form)
|
|
form_sauvegarder(form)
|
|
return redirect(url_for("PN"))
|
|
return render_template("PN.html", form = form)
|
|
|
|
@app.route("/AC", methods=["GET","POST"])
|
|
def AC():
|
|
form = ACForm()
|
|
form.referentiel.choices = [x for x in models.AC.query.all()]
|
|
form_validation = form.validate_on_submit()
|
|
form = form_import(form)
|
|
form = form_charger(form)
|
|
temp = form_supprimer(form)
|
|
if temp[0] == True: return temp[1]
|
|
else: form = temp[1]
|
|
if form_validation and not form.charger.data:
|
|
if form.exporter.data:
|
|
flash("Ajout du référentiel AC: {} ".format(form.code.data))
|
|
form_export(form)
|
|
form_sauvegarder(form)
|
|
return redirect(url_for("AC"))
|
|
return render_template("AC.html", form = form)
|
|
|
|
@app.route("/SAE", methods=["GET","POST"])
|
|
def SAE():
|
|
form = SAEForm()
|
|
form.referentiel.choices = [x for x in models.SAE.query.all()]
|
|
form_validation = form.validate_on_submit()
|
|
form = form_import(form)
|
|
form = form_charger(form)
|
|
temp = form_supprimer(form)
|
|
if temp[0] == True: return temp[1]
|
|
else: form = temp[1]
|
|
if form_validation and not form.charger.data:
|
|
if form.exporter.data:
|
|
flash("Ajout du référentiel SAE: {} ".format(form.code.data))
|
|
form_export(form)
|
|
form_sauvegarder(form)
|
|
return redirect(url_for("SAE"))
|
|
return render_template("SAE.html", form = form)
|
|
|
|
@app.route("/Ressource", methods=["GET","POST"])
|
|
def Ressource():
|
|
form = RessourceForm()
|
|
form.referentiel.choices = [x for x in models.Ressource.query.all()]
|
|
form_validation = form.validate_on_submit()
|
|
form = form_import(form)
|
|
form = form_charger(form)
|
|
temp = form_supprimer(form)
|
|
if temp[0] == True: return temp[1]
|
|
else: form = temp[1]
|
|
if form_validation and not form.charger.data:
|
|
if form.exporter.data:
|
|
flash("Ajout du référentiel Ressource: {} ".format(form.code.data))
|
|
form_export(form)
|
|
form_sauvegarder(form)
|
|
return redirect(url_for("Ressource"))
|
|
return render_template("Ressource.html", form = form)
|
|
|
|
@app.route("/Competence", methods=["GET","POST"])
|
|
def Competence():
|
|
form = CompetenceForm()
|
|
form.referentiel.choices = [x for x in models.Competence.query.all()]
|
|
form_validation = form.validate_on_submit()
|
|
form = form_import(form)
|
|
form = form_charger(form)
|
|
temp = form_supprimer(form)
|
|
if temp[0] == True: return temp[1]
|
|
else: form = temp[1]
|
|
if form_validation and not form.charger.data:
|
|
if form.exporter.data:
|
|
flash("Ajout du référentielCompetence: {} ".format(form.code.data))
|
|
form_export(form)
|
|
form_sauvegarder(form)
|
|
return redirect(url_for("Competence"))
|
|
return render_template("Competence.html", form = form) |