本文整理汇总了Python中models.team.Team.all方法的典型用法代码示例。如果您正苦于以下问题:Python Team.all方法的具体用法?Python Team.all怎么用?Python Team.all使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类models.team.Team
的用法示例。
在下文中一共展示了Team.all方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _upload_stats
# 需要导入模块: from models.team import Team [as 别名]
# 或者: from models.team.Team import all [as 别名]
def _upload_stats(team_name, stats):
query = Team.all()
query.filter('name =', team_name)
result = query.fetch(1)
if len(result) > 0:
for team in result:
team.year = Const.LAST_YEAR
team.offense_passing = stats['offense']['pass']
team.offense_rushing = stats['offense']['rush']
team.offense_first_down = stats['offense']['first_down']
team.defense_passing = stats['defense']['pass']
team.defense_rushing = stats['defense']['rush']
team.defense_first_down = stats['defense']['first_down']
team.put()
else:
team = Team(name = team_name,
year = Const.LAST_YEAR,
offense_passing = stats['offense']['pass'],
offense_rushing = stats['offense']['rush'],
offense_first_down = stats['offense']['first_down'],
defense_passing = stats['defense']['pass'],
defense_rushing = stats['defense']['rush'],
defense_first_down = stats['defense']['first_down'])
team.put()
示例2: _fetch_stats
# 需要导入模块: from models.team import Team [as 别名]
# 或者: from models.team.Team import all [as 别名]
def _fetch_stats(self):
result = {}
query = Team.all()
query.filter('name !=', 'Testing Team')
query_result = query.fetch(50)
for team in query_result:
name = (team.name).encode('ascii', 'ignore')
if name not in result:
result[name] = {}
if 'offense' not in result[name]:
result[name]['offense'] = {}
if 'defense' not in result[name]:
result[name]['defense'] = {}
offense = result[name]['offense']
offense['pass'] = int(team.offense_passing)
offense['rush'] = int(team.offense_rushing)
offense['first_down'] = int(team.offense_first_down)
defense = result[name]['defense']
defense['pass'] = int(team.defense_passing)
defense['rush'] = int(team.defense_rushing)
defense['first_down'] = int(team.defense_first_down)
return result