Esempio n. 1
0
def edit(prestation_id=None):

    if prestation_id:
        prestations = Prestation.get_by_id(prestation_id)
        form = FormPrestation(obj=prestations)
        form.id.data = prestations.key.id()
    else:
        prestations = Prestation()
        form = FormPrestation()

    success = False
    if form.validate_on_submit():

        prestations.libelle = form.libelle.data
        prestations.factu = form.factu.data
        prestations.nfactu = form.nfactu.data
        prestations.sigle = form.sigle.data
        prestations.put()

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

    return render_template('prestation/edit.html', **locals())
Esempio n. 2
0
def delete(prestation_id):
    prestations = Prestation.get_by_id(prestation_id)
    prestations.key.delete()
    flash('Suppression reussie', 'success')
    return redirect(url_for('prestation.index'))