本文整理汇总了Python中helpers.model_to_dict.ModelToDict.teamConverter方法的典型用法代码示例。如果您正苦于以下问题:Python ModelToDict.teamConverter方法的具体用法?Python ModelToDict.teamConverter怎么用?Python ModelToDict.teamConverter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类helpers.model_to_dict.ModelToDict
的用法示例。
在下文中一共展示了ModelToDict.teamConverter方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _render
# 需要导入模块: from helpers.model_to_dict import ModelToDict [as 别名]
# 或者: from helpers.model_to_dict.ModelToDict import teamConverter [as 别名]
def _render(self, event_key):
self._set_event(event_key)
teams = filter(None, self.event.teams)
team_dicts = [ModelToDict.teamConverter(team) for team in teams]
return json.dumps(team_dicts, ensure_ascii=True)
示例2: _render
# 需要导入模块: from helpers.model_to_dict import ModelToDict [as 别名]
# 或者: from helpers.model_to_dict.ModelToDict import teamConverter [as 别名]
def _render(self, district_abbrev, year=None):
self._set_district(district_abbrev)
district_teams = DistrictTeamsQuery("{}{}".format(self.year, self.district_abbrev)).fetch()
district_teams_dict = [ModelToDict.teamConverter(team) for team in district_teams]
return json.dumps(district_teams_dict, ensure_ascii=True)
示例3: _render
# 需要导入模块: from helpers.model_to_dict import ModelToDict [as 别名]
# 或者: from helpers.model_to_dict.ModelToDict import teamConverter [as 别名]
def _render(self, event_key):
self._set_cache_header_length(60 * 60)
self._set_event(event_key)
teams = self.event.teams
team_dicts = [ModelToDict.teamConverter(team) for team in teams]
return json.dumps(team_dicts, ensure_ascii=True)
示例4: _render
# 需要导入模块: from helpers.model_to_dict import ModelToDict [as 别名]
# 或者: from helpers.model_to_dict.ModelToDict import teamConverter [as 别名]
def _render(self, page_num):
page_num = int(page_num)
start = self.PAGE_SIZE * page_num
end = start + self.PAGE_SIZE
team_keys = Team.query(Team.team_number >= start, Team.team_number < end).fetch(None, keys_only=True)
team_futures = ndb.get_multi_async(team_keys)
team_list = [ModelToDict.teamConverter(team_future.get_result()) for team_future in team_futures]
return json.dumps(team_list, ensure_ascii=True)
示例5: _render
# 需要导入模块: from helpers.model_to_dict import ModelToDict [as 别名]
# 或者: from helpers.model_to_dict.ModelToDict import teamConverter [as 别名]
def _render(self, team_key, year=None):
self._write_cache_headers(61)
self.team = Team.get_by_id(self.team_key)
if self.team is None:
self._errors = json.dumps({"404": "%s team not found" % self.team_key})
self.abort(404)
events_sorted, matches_by_event_key, awards_by_event_key, _ = TeamDetailsDataFetcher.fetch(self.team, self.year)
team_dict = ModelToDict.teamConverter(self.team)
team_dict["events"] = list()
for event in events_sorted:
event_dict = ModelToDict.eventConverter(event)
event_dict["matches"] = [ModelToDict.matchConverter(match) for match in matches_by_event_key.get(event.key, [])]
event_dict["awards"] = [ModelToDict.awardConverter(award) for award in awards_by_event_key.get(event.key, [])]
team_dict["events"].append(event_dict)
return json.dumps(team_dict, ensure_ascii=True)
示例6: _render
# 需要导入模块: from helpers.model_to_dict import ModelToDict [as 别名]
# 或者: from helpers.model_to_dict.ModelToDict import teamConverter [as 别名]
def _render(self, team_key):
self._set_team(team_key)
team_dict = ModelToDict.teamConverter(self.team)
return json.dumps(team_dict, ensure_ascii=True)