本文整理汇总了Python中src.models.alerts.alert.Alert类的典型用法代码示例。如果您正苦于以下问题:Python Alert类的具体用法?Python Alert怎么用?Python Alert使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Alert类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: edit_alert
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,代码行数:10,代码来源:views.py
示例2: create_alert
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')
开发者ID:jslvtr,项目名称:alert-my-wishlist,代码行数:11,代码来源:views.py
示例3: create_alert
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
开发者ID:AlinaKay,项目名称:price-of-chair,代码行数:14,代码来源:views.py
示例4: create_alert
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')
开发者ID:FMGordillo,项目名称:price_of_chair_web,代码行数:15,代码来源:views.py
示例5: edit_alert
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,代码行数:8,代码来源:views.py
示例6: create_alert
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')
开发者ID:MaynardTool,项目名称:pricing-service,代码行数:18,代码来源:views.py
示例7:
from src.common.database import Database
from src.models.alerts.alert import Alert
__author__ = "Nupur Baghel"
Database.initialize()
alerts_needing_update=Alert.find_needing_update()
print(alerts_needing_update)
for alert in alerts_needing_update:
alert.load_item_price()
alert.send_email_if_price_is_reached()
开发者ID:nupurbaghel,项目名称:PriceAlertApp,代码行数:13,代码来源:alert_updater.py
示例8: get_alerts
def get_alerts(self):
return Alert.find_by_user_email(self.email)
开发者ID:AlinaKay,项目名称:price-of-chair,代码行数:2,代码来源:user.py
示例9: check_alert_price
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,代码行数:3,代码来源:views.py
示例10: get_alert_page
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,代码行数:3,代码来源:views.py
示例11: activate_alert
def activate_alert(alert_id):
Alert.find_by_id(alert_id).activate()
return redirect(url_for('users.user_alerts'))
开发者ID:MaynardTool,项目名称:pricing-service,代码行数:3,代码来源:views.py
示例12: delete_alert
def delete_alert(alert_id):
Alert.find_by_id(alert_id).delete()
return redirect(url_for('users.user_alerts'))
开发者ID:MaynardTool,项目名称:pricing-service,代码行数:3,代码来源:views.py
示例13: get_alerts
def get_alerts(self):
return Alert.find_by_user_email(self.email) # llamo desde aca porque si no la view de user tiene que tratar con dos modelos distintos (user y alert) y no esta bien
开发者ID:FMGordillo,项目名称:price_of_chair_web,代码行数:2,代码来源:user.py
示例14:
from src.common.database import Database
from src.models.alerts.alert import Alert
Database.initialize()
finding_need_alert = Alert.find_update_alert()
for alert in finding_need_alert:
alert.load_item_price()
alert.send_email_if_price_reached()
开发者ID:jslvtr,项目名称:alert-my-wishlist,代码行数:11,代码来源:alert_updater.py
示例15: get_alert_page
def get_alert_page(alert_id):
return render_template('alerts/alert.jinja2', alert=Alert.find_by_id(alert_id))
开发者ID:AlinaKay,项目名称:price-of-chair,代码行数:2,代码来源:views.py
注:本文中的src.models.alerts.alert.Alert类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论