Ajout ACs

This commit is contained in:
Éric Li 2021-05-06 12:19:06 +02:00
parent 016913078b
commit 92bb40d585
3 changed files with 23 additions and 1 deletions

View File

@ -31,6 +31,8 @@ class ACForm(Form):
regex = "^AC\d{4}$" regex = "^AC\d{4}$"
code = StringField("Code", validators=[DataRequired(), Regexp("^AC\d{4}$", message="Le code doit être de la forme AC0000.")]) code = StringField("Code", validators=[DataRequired(), Regexp("^AC\d{4}$", message="Le code doit être de la forme AC0000.")])
titre = StringField("Titre", validators=[DataRequired()] )
saes = StringField("SAEs", validators=[DataRequired()] )
class SAEForm(Form): class SAEForm(Form):

View File

@ -23,7 +23,14 @@ def PN():
@app.route("/AC", methods=["GET","POST"]) @app.route("/AC", methods=["GET","POST"])
def AC(): def AC():
return render_template("PN.html", form = form) form = ACForm()
form_validation = form.validate_on_submit()
form = form_import(form)
if form_validation and form.exporter.data:
flash("Ajout du référentiel AC: {} ".format(form.code.data))
form_export(form)
return redirect(url_for("AC"))
return render_template("AC.html", form = form)
@app.route("/SAE", methods=["GET","POST"]) @app.route("/SAE", methods=["GET","POST"])
def SAE(): def SAE():

13
app/templates/AC.html Normal file
View File

@ -0,0 +1,13 @@
{% extends "form.html" %}
{% block title %}AC Form{% endblock %}
{% block form_title %}Formulaire d'Apprentissages Critiques (AC){% endblock %}
{% block formulaire %}
{{ render_field(form.code,"input") }}
{{ render_field(form.titre,"input") }}
{{ render_field(form.saes,"input") }}
{% endblock %}