Example #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))
Example #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))
Example #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
Example #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))
Example #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))
Example #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)
Example #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)
Example #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)
Example #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)
Example #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)
Example #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)
Example #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)
Example #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)
Example #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)
Example #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)
Example #18
0
def get_alert_page(alert_id):
    return render_template('alerts/alert.jinja2', alert=Alert.find_by_id(alert_id))
Example #19
0
def get_alert_page(alert_id):
    alert = Alert.find_by_id(alert_id)
    return render_template('/alerts/alert.html', alert=alert)
Example #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)))
Example #21
0
def delete_alert(alert_id):
    Alert.find_by_id(alert_id).delete()
    return redirect(url_for('users.user_alerts'))
Example #22
0
def activate_alert(alert_id):
    Alert.find_by_id(alert_id).activate()
    return redirect(url_for('users.user_alerts'))
Example #23
0
def get_alert_page(alert_id):
    alert = Alert.find_by_id(alert_id)
    return render_template('alerts/alert.html', alert=alert)
Example #24
0
def activate_alert(alert_id):
    Alert.find_by_id(alert_id).activate()
    return redirect(url_for('alerts.index'))
Example #25
0
def deactivate_alert(alert_id):
    Alert.find_by_id(alert_id).deactivate()
    return redirect(url_for('.user.user_alerts'))
Example #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'))
Example #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)
Example #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)
Example #29
0
def delete_alert(alert_id):
    Alert.find_by_id(alert_id).remove()
    flash('Alert Successfully Deleted.')
    return redirect(url_for('users.user_alerts'))
Example #30
0
def get_alert_page(alert_id):
    alert = Alert.find_by_id(alert_id)
    return render_template("alerts/alert.jinja2", alert=alert)
Example #31
0
def view_alert(alert_id):
    alert = Alert.find_by_id(alert_id)
    return render_template('alerts/alert.html', alert=alert)
Example #32
0
def activate_alert(alert_id):
    Alert.find_by_id(alert_id).activate()
    return redirect(url_for('users.user_alerts'))
Example #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))
Example #34
0
def delete_alert(alert_id):
    Alert.find_by_id(alert_id).delete()
    return redirect(url_for('users.user_alerts'))
Example #35
0
def get_alert_page(alert_id):
    return render_template('alerts/alert.jinja2',
                           alert=Alert.find_by_id(alert_id))
Example #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))
Example #37
0
def delete_alert(alert_id):
    Alert.find_by_id(alert_id).delete()
    return redirect(url_for('alerts.index'))