def edit_alert(alert_id): alert = Alert.from_db_by_id(alert_id) if request.method == 'POST': name = request.form['item_name'] price_limit = float(request.form['price_limit']) alert.item.name = name alert.price_limit = price_limit alert.item.save_to_db() alert.save_to_db() flash("Update alert thanh cong") return redirect(url_for('users.user_alerts')) return render_template('alerts/edit_alert.jinja2', alert=alert)
def check_alert_price(alert_id): Alert.from_db_by_id(alert_id).load_item_price() return redirect(url_for('.get_alert_page', alert_id=alert_id))
def get_alert_page(alert_id): alert = Alert.from_db_by_id(alert_id) return render_template("alerts/alerts.jinja2", alert=alert)
def delete_alert(alert_id): Alert.from_db_by_id(alert_id).delete() return redirect(url_for('users.user_alerts'))