本文整理汇总了Python中models.event.Event.divisions方法的典型用法代码示例。如果您正苦于以下问题:Python Event.divisions方法的具体用法?Python Event.divisions怎么用?Python Event.divisions使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类models.event.Event
的用法示例。
在下文中一共展示了Event.divisions方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: store_event
# 需要导入模块: from models.event import Event [as 别名]
# 或者: from models.event.Event import divisions [as 别名]
def store_event(data):
event = Event(id=data['key'])
event.name = data['name']
event.short_name = data['short_name']
event.event_short = data['event_code']
event.event_type_enum = data['event_type']
event.year = data['year']
event.timezone_id = data['timezone']
event.website = data['website']
event.start_date = datetime.datetime.strptime(data['start_date'], EVENT_DATE_FORMAT_STR) if data['start_date'] else None
event.end_date = datetime.datetime.strptime(data['end_date'], EVENT_DATE_FORMAT_STR) if data['end_date'] else None
event.webcast_json = json.dumps(data['webcasts'])
event.venue = data['location_name']
event.city = data['city']
event.state_prov = data['state_prov']
event.country = data['country']
event.playoff_type = data['playoff_type']
event.parent_event = ndb.Key(Event, data['parent_event_key']) if data['parent_event_key'] else None
event.divisions = [ndb.Key(Event, div_key) for div_key in data['division_keys']] if data['division_keys'] else []
district = store_district(data['district']) if data['district'] else None
event.district_key = district.key if district else None
return EventManipulator.createOrUpdate(event)