本文整理汇总了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')