forked from eric.li/EditionPN
Ajout ExportYAML
This commit is contained in:
parent
d7d30e43dd
commit
f5e435c267
11
app/forms.py
11
app/forms.py
@ -59,6 +59,17 @@ class AccueilForm(FlaskForm):
|
|||||||
with open(fichier, "w", encoding="utf8") as fid:
|
with open(fichier, "w", encoding="utf8") as fid:
|
||||||
json.dump(result, fid, cls=CustomEncoder, indent=4)
|
json.dump(result, fid, cls=CustomEncoder, indent=4)
|
||||||
|
|
||||||
|
def exportYAML(self):
|
||||||
|
result = {"semestres": [], "competences": [], "acs": [], "pns": [], "saes": [], "coefsaes": [], "ressources": [], "coefressources": []}
|
||||||
|
for key in result.keys():
|
||||||
|
model = getattr(models, categorie_to_model[key])
|
||||||
|
for ref in model.query.all():
|
||||||
|
result[key].append(ref.export())
|
||||||
|
fichier = REPERTOIRE_EXPORT + "referentiels" + ".yml"
|
||||||
|
with open(fichier, "w", encoding="utf8") as fid:
|
||||||
|
yaml.dump(yaml.safe_load(json.dumps(result, cls=CustomEncoder)), fid, indent=4)
|
||||||
|
|
||||||
|
|
||||||
class CoefForm(FlaskForm):
|
class CoefForm(FlaskForm):
|
||||||
objetformation = HiddenField("Objet de formation")
|
objetformation = HiddenField("Objet de formation")
|
||||||
coef = StringField("Coef")
|
coef = StringField("Coef")
|
||||||
|
Loading…
Reference in New Issue
Block a user