當前位置: 首頁>>代碼示例>>Python>>正文


Python Alert.find_by_id方法代碼示例

本文整理匯總了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
開發者ID:AlinaKay,項目名稱:price-of-chair,代碼行數:12,代碼來源:views.py

示例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)
開發者ID:nupurbaghel,項目名稱:PriceAlertApp,代碼行數:10,代碼來源:views.py

示例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)))
開發者ID:MaynardTool,項目名稱:pricing-service,代碼行數:5,代碼來源:views.py

示例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)
開發者ID:MaynardTool,項目名稱:pricing-service,代碼行數:5,代碼來源:views.py

示例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'))
開發者ID:MaynardTool,項目名稱:pricing-service,代碼行數:5,代碼來源:views.py

示例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'))
開發者ID:MaynardTool,項目名稱:pricing-service,代碼行數:5,代碼來源:views.py

示例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))
開發者ID:AlinaKay,項目名稱:price-of-chair,代碼行數:4,代碼來源:views.py


注:本文中的src.models.alerts.alert.Alert.find_by_id方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。