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