Exemplo n.º 1
0
def delete(id):
    """Softdeletes a dish"""
    Dish.update(isDeleted=True).where(Dish.id == id).execute()
    flash('Dish deleted', 'success')
    return redirect(url_for('caterers.index'))
Exemplo n.º 2
0
def restore(id):
    """Restores a soft deleted dish"""
    Dish.update(isDeleted=False).where(Dish.id == id).execute()
    flash('Dish restored', 'success')
    return redirect(url_for('dishes.edit', id=id))
Exemplo n.º 3
0
def processEdit(id, name, price, caterer):
    """Updates a dish based on POST data"""
    Dish.update(name=name, price=price,
                caterer=Caterer.select().where(Caterer.id == caterer).get()).where(Dish.id == id).execute()
    flash("Dish updated", 'success')
    return redirect(url_for('caterers.index'))