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))
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))
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
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))
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))
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)
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)
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)
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)
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)
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)
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)
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)
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)
def get_alert_page(alert_id): return render_template('alerts/alert.jinja2', alert=Alert.find_by_id(alert_id))
def get_alert_page(alert_id): alert = Alert.find_by_id(alert_id) return render_template('/alerts/alert.html', alert=alert)
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)))
def delete_alert(alert_id): Alert.find_by_id(alert_id).delete() return redirect(url_for('users.user_alerts'))
def activate_alert(alert_id): Alert.find_by_id(alert_id).activate() return redirect(url_for('users.user_alerts'))
def get_alert_page(alert_id): alert = Alert.find_by_id(alert_id) return render_template('alerts/alert.html', alert=alert)
def activate_alert(alert_id): Alert.find_by_id(alert_id).activate() return redirect(url_for('alerts.index'))
def deactivate_alert(alert_id): Alert.find_by_id(alert_id).deactivate() return redirect(url_for('.user.user_alerts'))
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'))
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)
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'))
def get_alert_page(alert_id): alert = Alert.find_by_id(alert_id) return render_template("alerts/alert.jinja2", alert=alert)
def view_alert(alert_id): alert = Alert.find_by_id(alert_id) return render_template('alerts/alert.html', alert=alert)
def activate_alert(alert_id): Alert.find_by_id(alert_id).activate() return redirect(url_for('.get_alert_page', alert_id=alert_id))
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))
def delete_alert(alert_id): Alert.find_by_id(alert_id).delete() return redirect(url_for('alerts.index'))