def create_alert(): if request.method == "POST": item_name = request.form['item_name'] item_url = request.form['item_url'] price_limit = request.form['price_limit'] item = Item(str(item_name), str(item_url)) item.save_to_mongo() alert = Alert(session['email'], price_limit, item._id) alert.load_item_price() # this is already saving to mongodb return redirect(url_for('user.user_alerts')) return render_template("alerts/create_alert.html")
def create_alert(): if request.method == "POST": name = request.form['name'] url = request.form['url'] price_limit = float(request.form['price_limit']) item = Item(name, url) item.save_to_mongo() alert = Alert(session['email'], price_limit, item._id) alert.load_item_price() return render_template("alerts/new_alert.html")
def create_alert(): if request.method == 'POST': name = request.form['name'] url = request.form['url'] price_limit = float(request.form['price_limit']) item = Item(name, url) item.save_to_mongo() alert = Alert(session['email'], price_limit, item._id) 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/new_alert.html") # Send the user an error if their login was invalid