Beispiel #1
0
def edit_alert(alert_id):
    if request.method == 'POST':
        price_limit = float(request.form['price_limit'])

        alert = Alert.find_by_id(alert_id)
        alert.price_limit = price_limit
        alert.load_item_price()  # This already saves to MongoDB
        return redirect(url_for("users.user_alerts"))
    # What happens if it's a GET request
    return render_template("alerts/edit_alert.html", alert=Alert.find_by_id(alert_id))  # Send the user an error if their login was invalid
Beispiel #2
0
def edit_alert(alert_id):
    alert = Alert.find_by_id(alert_id)
    if request.method == "POST":
        price_limit = float(request.form['price_limit'])
        alert.price_limit = price_limit
        alert.save_to_mongo()
        return redirect(url_for("user.user_alerts"))
    return render_template("alerts/edit_alert.html", alert=alert)
Beispiel #3
0
def edit_alert(alert_id):
    alert = Alert.find_by_id(alert_id)
    if request.method == 'POST':
        price_limit = float(request.form['price_limit'])

        alert.price_limit = price_limit
        alert.save_to_mongo()
        return redirect(url_for('users.user_alerts'))
    return render_template('alerts/edit_alert.html', alert=alert)
Beispiel #4
0
def check_alert_price(alert_id):
    Alert.find_by_id(alert_id).load_item_price()
    return redirect(url_for('.get_alert_page', alert_id=alert_id))
Beispiel #5
0
def get_alert_page(alert_id):
    return render_template('alerts/alert.jinja2',
                           alert=Alert.find_by_id(alert_id))
Beispiel #6
0
def delete_alert(alert_id):
    Alert.find_by_id(alert_id).delete()
    return redirect(url_for('users.user_alerts'))
Beispiel #7
0
def activate_alert(alert_id):
    Alert.find_by_id(alert_id).activate()
    return redirect(url_for('users.user_alerts'))
Beispiel #8
0
def get_alert_page(alert_id):
    alert = Alert.find_by_id(alert_id)
    return render_template("alerts/alert.html", alert=alert)
Beispiel #9
0
def check_alert_price(alert_id):
    alert = Alert.find_by_id(alert_id)
    alert.load_item_price()
    return redirect(url_for('users.user_alerts'))
Beispiel #10
0
def deactivate_alert(alert_id):
    alert = Alert.find_by_id(alert_id)
    alert.deactivate()
    return redirect(url_for('users.user_alerts'))
Beispiel #11
0
def activate_alert_success(alert_id):
    alert = Alert.find_by_id(alert_id)
    return render_template('alerts/activate_alert_success.html.j2', alert=alert)
Beispiel #12
0
def activate_alert(alert_id):
    Alert.find_by_id(alert_id).activate()
    return redirect(url_for('.activate_alert_success', alert_id=alert_id))
Beispiel #13
0
def delete_alert(alert_id):
    Alert.find_by_id(alert_id).delete()
    return redirect(url_for('.delete_alert_success', alert_id=alert_id))