Esempio n. 1
0
def delete(fonction_id):
    fonctions = Fonction.get_by_id(fonction_id)
    if not fonctions.count():
        fonctions.key.delete()
        flash('Suppression reussie', 'success')
    else:
        flash('Impossible de supprimer', 'danger')
    return redirect(url_for('fonction.index'))
Esempio n. 2
0
def edit(fonction_id=None):

    if fonction_id:
        grades = Fonction.get_by_id(fonction_id)
        form = FormFonction(obj=grades)
    else:
        grades = Fonction()
        form = FormFonction()

    success = False
    if form.validate_on_submit():

        grades.libelle = form.libelle.data
        grades.put()

        flash('Enregistement effectue avec succes', 'success')
        success = True

    return render_template('fonction/edit.html', **locals())