ANNEXE
Code source Flask pour l'enrôlement de l'enfant
1.
@app.route('/enrolement', methods=['POST', 'GET'])
2. def enrolement_page():
3.
if request.method == 'POST':
4.
adminDetail = request.form
5.
nom = adminDetail['nomE']
6.
postnom = adminDetail['postnomE']
7.
prenom = adminDetail['prenomE']
8.
sexe= adminDetail['sexe']
9.
date = adminDetail['dateNaissance']
10.
nomPere = adminDetail['nomPere']
11.
nomMere = adminDetail['nomMere']
12.
phonePere = adminDetail['numPere']
13.
phoneMere = adminDetail['numMere']
14.
ville = adminDetail['ville']
15.
commune = adminDetail['commune']
16.
quartier = adminDetail['quartier']
17.
cellule = adminDetail['cellule']
18.
avenue = adminDetail['avenue']
19.
numParcelle = adminDetail['numParcelle']
20.
longitude = adminDetail['longitude']
21.
latitude = adminDetail['latitude']
22. 23.
cur = mysql.connection.cursor()
24.
cur.execute("INSERT INTO enfant (nomEnfant, postnomEnfant, prenomEnfant, sexe, nomPere, nomMere, dateNaissance, phonePere, phoneMere, ville, commune, quartier, cellule, avenue, numParcelle, longitude, latitude, idAdmin) VALUES(%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)", (nom, postnom, prenom, sexe, nomPere, nomMere, date, phonePere, phoneMere, ville, commune, quartier, cellule, avenue, numParcelle, longitude, latitude, 1))
25. 26.
mysql.connection.commit()
27.
cur.close()
28.
return "<h1>reussi</h1>"
29.
30.
return render_template("enrolement.html", result=output)
|