Ejemplo n.º 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
Ejemplo n.º 2
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()

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