Exemplo n.º 1
0
def delete(alert_id: str):
    """Deletes an existing alert."""
    alert = Alert.fetch_by_id(alert_id)
    if alert.user_email == session['email']:
        alert.delete()

    return redirect(url_for('.index'))
Exemplo n.º 2
0
def update(alert_id: str):
    """Updates an existing alert."""
    alert = Alert.fetch_by_id(alert_id)

    if request.method == 'POST':
        alert.price_floor = float(request.form['price-limit'])
        alert.save_to_db()
        return redirect(url_for('.index'))

    return render_template('alerts/edit.html', alert=alert)