예제 #1
0
def edit_alert(alert_id):
    alert = Alert.get_element_by_id(alert_id)

    if request.method == "POST":
        price_limit = float(request.form['price_limit'])
        alert.price_limit = price_limit
        alert.save_to_database()

        return redirect(url_for('.index'))  # this changes to the index endpoint defined within this blueprint the dot means within the current blueprint

    return render_template('alerts/edit_alert.html', alert=alert)
예제 #2
0
def delete_alert(alert_id):
    alert = Alert.get_element_by_id(alert_id)
    if alert.user_email == session['email']:
        alert.remove_from_database()

    return redirect(url_for(".index"))