本文整理匯總了Python中src.models.alerts.alert.Alert.load_item_price方法的典型用法代碼示例。如果您正苦於以下問題:Python Alert.load_item_price方法的具體用法?Python Alert.load_item_price怎麽用?Python Alert.load_item_price使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類src.models.alerts.alert.Alert
的用法示例。
在下文中一共展示了Alert.load_item_price方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: create_alert
# 需要導入模塊: from src.models.alerts.alert import Alert [as 別名]
# 或者: from src.models.alerts.alert.Alert import load_item_price [as 別名]
def create_alert():
if request.method == 'POST':
name = request.form['name']
url = request.form['url']
price_limit = float(request.form['price'])
item = Item(name, url)
item.save_to_mongo()
alert = Alert(session['email'], price_limit, item._id)
alert.load_item_price()
return render_template('alerts/create_alert.html')
示例2: create_alert
# 需要導入模塊: from src.models.alerts.alert import Alert [as 別名]
# 或者: from src.models.alerts.alert.Alert import load_item_price [as 別名]
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
# What happens if it's a GET request
return render_template("alerts/new_alert.jinja2") # Send the user an error if their login was invalid
示例3: create_alert
# 需要導入模塊: from src.models.alerts.alert import Alert [as 別名]
# 或者: from src.models.alerts.alert.Alert import load_item_price [as 別名]
def create_alert():
if request.method == 'POST':
name = request.form['name']
url = request.form['url']
price_limit = float(request.form['price_limit'])
# el constructor de Alert busca el item por id asi que el item tiene que existir antes de ccrear la alert
item = Item(name, url)
item.save_to_mongo()
alert = Alert(session['email'], price_limit, item._id)
alert.load_item_price() #ya salva la alert a mongo
return render_template('alerts/new_alert.html')
示例4: create_alert
# 需要導入模塊: from src.models.alerts.alert import Alert [as 別名]
# 或者: from src.models.alerts.alert.Alert import load_item_price [as 別名]
def create_alert():
if request.method == 'POST':
name = request.form['name']
url = request.form['url']
price_limit = float(request.form['price-limit'])
# create an item first
item = Item(name, url)
item.save_to_mongo()
# now create an alert to this item
alert = Alert(session['email'], price_limit, item._id)
alert.load_item_price() # this already saves to MongoDB
# return redirect(url_for('user_alerts'))
# What happens if it's a GET request
return render_template('/alerts/new_alert.html')