本文整理汇总了Python中app.models.Event.tid_in方法的典型用法代码示例。如果您正苦于以下问题:Python Event.tid_in方法的具体用法?Python Event.tid_in怎么用?Python Event.tid_in使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app.models.Event
的用法示例。
在下文中一共展示了Event.tid_in方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_all
# 需要导入模块: from app.models import Event [as 别名]
# 或者: from app.models.Event import tid_in [as 别名]
def get_all(self):
args = request.args
query = TriggeredEventModel.query
pids = args.getlist("pid")
liids = args.getlist("liid")
lids = args.getlist("lid")
ltids = args.getlist("ltid")
tids = args.getlist("tid")
eids = args.getlist("eid")
if pids or liids or lids or ltids:
participations = ParticipationModel.query.with_entities(
ParticipationModel.id)
if pids:
participations = participations.filter(
ParticipationModel.pid.in_(pids))
if ltids or lids:
level_instance = LevelInstanceModel.query
if ltids:
levels = LevelModel.query.with_entities(
LevelModel.id).join(LevelModel.level_types).\
filter(LevelModel.level_types.in_(ltids)).all()
lids += levels
if lids:
level_instances = level_instance.filter(
LevelInstanceModel.lid.in_(lids)).all()
liids += level_instances
if liids:
participations = participations.filter(
ParticipationModel.liid.in_(liids))
query = query.filter(TriggeredEventModel.paid.in_(participations))
if tids:
tasks = EventModel.query.with_entities(
EventModel.id).filter(EventModel.tid_in(tids)).all()
eids += tasks
if eids:
query = query.filter(TriggeredEventModel.eid.in_(eids))
triggered_events = query.order_by(TriggeredEventModel.id).all()
data = []
for t in triggered_events:
data.append(get_triggered_event_json(t))
return data