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.jinja2", alert=Alert.find_by_id(alert_id))  # Send the user an error if their login was invalid
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()

    return render_template("alerts/edit_alert.html", alert=Alert.find_by_id(alert_id))
Beispiel #3
0
def edit_alert(alert_id):
    if request.method == 'POST':
        price_limit = request.form['price-limit']
        alert = Alert.find_by_id(alert_id)
        alert.price_limit = price_limit
        alert.save_to_mongo()
        return redirect(url_for('users.user_alerts'))

    return render_template('alerts/edit_alert.jinja2',
                           alert=Alert.find_by_id(alert_id))
Beispiel #4
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

    # What happens if it's a GET request
    return render_template("alerts/edit_alert.jinja2", alert=Alert.find_by_id(alert_id))  # Send the user an error if their login was invalid
Beispiel #5
0
def edit_alert(alert_id):
    if request.method == 'POST':
        price_limit = Utils.get_price_float(request.form['price_limit'])
        alert = Alert.find_by_id(alert_id)
        alert.price_limit = price_limit
        alert.load_item_price()
        return redirect(url_for('.get_alert_page', alert_id=alert_id))

    # METHOD GET
    return render_template("alerts/edit_alert.html",
                           alert=Alert.find_by_id(alert_id))
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.save_to_mongo()
        flash("Alert {} successfully updated.".format(alert_id))
        return redirect(url_for('users.user_alerts'))

    return render_template('alerts/edit_alert.html',
                           alert=Alert.find_by_id(alert_id))
Beispiel #7
0
def edit_alert(alert_id):
    if request.method == 'POST':
        price_limit = float(request.form['price_limit'])

        alert = Alert.find_by_id(session['email'], alert_id)
        alert.price_limit = price_limit
        alert.load_item_price()
        user = User.find_by_email(session['email'])
        return render_template("users/alerts.jinja2",
                               alerts=user.get_alerts(),
                               user=user)

    return render_template("alerts/edit_alert.jinja2",
                           alert=Alert.find_by_id(session['email'], alert_id))
Beispiel #8
0
def edit_alert(alert_id):
    # method to modify existing alerts
    alert = Alert.find_by_id(alert_id)
    # we first find it
    if request.method == 'POST':
        price_limit = float(request.form['price_limit'])
        alert = Alert.find_by_id(alert_id)
        alert.price_limit = price_limit
        # change the price limit
        alert.save_to_mongo()
        # then save to database

        return redirect(url_for('users.user_alerts'))
    return render_template('alerts/edit_alert.jinja2', alert=alert)
Beispiel #9
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 = Alert.find_by_id(alert_id)
        alert.price_limit = price_limit

        alert.save_to_mongo()

        return redirect(url_for('users.user_alerts'))

    # What happens if it's a GET request
    return render_template('alerts/edit_alert.jinja2', alert=alert)
Beispiel #10
0
def edit_alert(alert_id):
    alert = Alert.find_by_id(alert_id)
    if request.method == 'POST':
        alert.price_limit = float(request.form['price_limit'])
        alert.save_to_db()
        return redirect(url_for('users.user_alerts'))
    return render_template('alerts/edit_alert.html', alert=alert)
Beispiel #11
0
def edit_alert(alert_id):
    alert = Alert.find_by_id(alert_id)
    if request.method == "POST":
        price_limit = request.form['price_limit']
        alert.price_limit = price_limit
        alert.save()
        return redirect(url_for('users.user_alerts'))
    return render_template('alerts/edit_alert.html', alert=alert)
Beispiel #12
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 #13
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.update_db()
        return redirect(url_for('alerts.index'))

    return render_template('alerts/edit_alert.html', alert=alert)
Beispiel #14
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.seve_to_mongo()
        return redirect(url_for('.get_alert_page', alert_id=alert_id))

    return render_template('alerts/edit_alert.html', alert=alert)
Beispiel #15
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.load_item_price()  # this already saves to db

        return redirect(url_for('users.user_alerts'))

    return render_template('alerts/edit_alert.html', alert=alert)
Beispiel #16
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.to_mongo()

        return redirect(url_for("users.user_alerts"))

    return render_template("alerts/edit_alert.jinja2", alert=alert)
Beispiel #17
0
def get_alert_page(alert_id):
    alert = Alert.find_by_id(alert_id)
    #passing price and dates list in order to draw a chart
    price_list = []
    date_list = []
    prices = Price.get_user_price_by_alert(alert_id, alert.activate_date)

    for price in prices:
        price_list.append(price.price)
        date_list.append(price.create_date)

    return render_template('alerts/alert.html',
                           alert=alert,
                           price_list=price_list,
                           date_list=date_list)
Beispiel #18
0
def get_alert_page(alert_id):
    return render_template('alerts/alert.jinja2', alert=Alert.find_by_id(alert_id))
Beispiel #19
0
def get_alert_page(alert_id):
    alert = Alert.find_by_id(alert_id)
    return render_template('/alerts/alert.html', alert=alert)
Beispiel #20
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 #21
0
def delete_alert(alert_id):
    Alert.find_by_id(alert_id).delete()
    return redirect(url_for('users.user_alerts'))
Beispiel #22
0
def activate_alert(alert_id):
    Alert.find_by_id(alert_id).activate()
    return redirect(url_for('users.user_alerts'))
Beispiel #23
0
def get_alert_page(alert_id):
    alert = Alert.find_by_id(alert_id)
    return render_template('alerts/alert.html', alert=alert)
Beispiel #24
0
def activate_alert(alert_id):
    Alert.find_by_id(alert_id).activate()
    return redirect(url_for('alerts.index'))
Beispiel #25
0
def deactivate_alert(alert_id):
    Alert.find_by_id(alert_id).deactivate()
    return redirect(url_for('.user.user_alerts'))
Beispiel #26
0
def delete_alert(alert_id):
    # we delete an alert by calling the method defined in Alert class
    Alert.find_by_id(alert_id).delete()
    return redirect(url_for('users.user_alerts'))
Beispiel #27
0
def delete_alert(alert_id):
    Alert.find_by_id(session['email'], alert_id).delete()
    user = User.find_by_email(session['email'])
    return render_template("users/alerts.jinja2",
                           alerts=user.get_alerts(),
                           user=user)
Beispiel #28
0
def get_alert_page(alert_id):
    # redirect users to the specific alert page
    alert = Alert.find_by_id(alert_id)
    return render_template('alerts/alert.jinja2', alert=alert)
def delete_alert(alert_id):
    Alert.find_by_id(alert_id).remove()
    flash('Alert Successfully Deleted.')
    return redirect(url_for('users.user_alerts'))
Beispiel #30
0
def get_alert_page(alert_id):
    alert = Alert.find_by_id(alert_id)
    return render_template("alerts/alert.jinja2", alert=alert)
Beispiel #31
0
def view_alert(alert_id):
    alert = Alert.find_by_id(alert_id)
    return render_template('alerts/alert.html', alert=alert)
Beispiel #32
0
def activate_alert(alert_id):
    Alert.find_by_id(alert_id).activate()
    return redirect(url_for('users.user_alerts'))
Beispiel #33
0
def activate_alert(alert_id):
    Alert.find_by_id(alert_id).activate()
    return redirect(url_for('.get_alert_page', alert_id=alert_id))
Beispiel #34
0
def delete_alert(alert_id):
    Alert.find_by_id(alert_id).delete()
    return redirect(url_for('users.user_alerts'))
Beispiel #35
0
def get_alert_page(alert_id):
    return render_template('alerts/alert.jinja2',
                           alert=Alert.find_by_id(alert_id))
Beispiel #36
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 #37
0
def delete_alert(alert_id):
    Alert.find_by_id(alert_id).delete()
    return redirect(url_for('alerts.index'))