本文整理汇总了Python中app.models.Event.query方法的典型用法代码示例。如果您正苦于以下问题:Python Event.query方法的具体用法?Python Event.query怎么用?Python Event.query使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app.models.Event
的用法示例。
在下文中一共展示了Event.query方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: parse
# 需要导入模块: from app.models import Event [as 别名]
# 或者: from app.models.Event import query [as 别名]
def parse(msg):
msg = msg.split('::: A USER HAS ENTERED A REQUEST FOR A AUDIO VISUAL WORK ORDER ::::')
if len(msg) != 2:
# decline all messages that aren't work orders
logging.error("Message is not a valid work order. Disposing message.")
return
# split up the divider between info and equipment
vals = msg[1].split('================================================')
if len(vals) != 2: # decline all messages that aren't work orders
return
info = parse_info(vals[0], vals[1])
logging.info(info)
if info is None:
return
events_query = Event.query(
ndb.AND(Event.name == info['name'], Event.date == info['date']),
ndb.AND(Event.end_time == info['end_time'], Event.start_time == info['start_time'])
)
events_list = events_query.fetch()
if len(events_list) == 0:
Event(**info).put()
示例2: add_info
# 需要导入模块: from app.models import Event [as 别名]
# 或者: from app.models.Event import query [as 别名]
def add_info(info):
events_query = Event.query(
ndb.AND(Event.name == info['name'], Event.date == info['date']),
ndb.AND(Event.end_time == info['end_time'], Event.start_time == info['start_time'])
)
events_list = events_query.fetch()
if not len(events_list) == 0:
for val in events_list:
val.key.delete()
Event(**info).put()