本文整理匯總了Python中src.models.alerts.alert.Alert.find_by_id方法的典型用法代碼示例。如果您正苦於以下問題:Python Alert.find_by_id方法的具體用法?Python Alert.find_by_id怎麽用?Python Alert.find_by_id使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類src.models.alerts.alert.Alert
的用法示例。
在下文中一共展示了Alert.find_by_id方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: edit_alert
# 需要導入模塊: from src.models.alerts.alert import Alert [as 別名]
# 或者: from src.models.alerts.alert.Alert import find_by_id [as 別名]
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
示例2: edit_alert
# 需要導入模塊: from src.models.alerts.alert import Alert [as 別名]
# 或者: from src.models.alerts.alert.Alert import find_by_id [as 別名]
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)
示例3: check_alert_price
# 需要導入模塊: from src.models.alerts.alert import Alert [as 別名]
# 或者: from src.models.alerts.alert.Alert import find_by_id [as 別名]
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)))
示例4: get_alert_page
# 需要導入模塊: from src.models.alerts.alert import Alert [as 別名]
# 或者: from src.models.alerts.alert.Alert import find_by_id [as 別名]
def get_alert_page(alert_id):
alert = Alert.find_by_id(alert_id)
return render_template('/alerts/alert.html', alert=alert)
示例5: activate_alert
# 需要導入模塊: from src.models.alerts.alert import Alert [as 別名]
# 或者: from src.models.alerts.alert.Alert import find_by_id [as 別名]
def activate_alert(alert_id):
Alert.find_by_id(alert_id).activate()
return redirect(url_for('users.user_alerts'))
示例6: delete_alert
# 需要導入模塊: from src.models.alerts.alert import Alert [as 別名]
# 或者: from src.models.alerts.alert.Alert import find_by_id [as 別名]
def delete_alert(alert_id):
Alert.find_by_id(alert_id).delete()
return redirect(url_for('users.user_alerts'))
示例7: get_alert_page
# 需要導入模塊: from src.models.alerts.alert import Alert [as 別名]
# 或者: from src.models.alerts.alert.Alert import find_by_id [as 別名]
def get_alert_page(alert_id):
return render_template('alerts/alert.jinja2', alert=Alert.find_by_id(alert_id))