예제 #1
0
def reserva_delete():
    form = DeleteReserveForm(request.form)
    if form.validate_on_submit():
        try:
            reserva = Reserva.get(Reserva.id == form.reserva_id.data,Reserva.cliente == current_user.id,Reserva.cancelado == False)
            reserva.delete_instance()
        except:
            None
    return redirect(url_for('ver_reservas'))
예제 #2
0
def admin_reservas_delete():
    if not current_user.is_admin():
        return redirect(url_for('index'))
    form = DeleteReserveForm(request.form)
    if form.validate_on_submit():
        try:
            reserva = Reserva.get(Reserva.id == form.reserva_id.data)
            reserva.delete_instance()
        except:
            None
    return redirect(url_for('admin_reservas'))