本文整理汇总了Python中models.robot.Robot.query方法的典型用法代码示例。如果您正苦于以下问题:Python Robot.query方法的具体用法?Python Robot.query怎么用?Python Robot.query使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类models.robot.Robot
的用法示例。
在下文中一共展示了Robot.query方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get
# 需要导入模块: from models.robot import Robot [as 别名]
# 或者: from models.robot.Robot import query [as 别名]
def get(self, team_number):
self._require_admin()
team = Team.get_by_id("frc" + team_number)
if not team:
self.abort(404)
event_teams = EventTeam.query(EventTeam.team == team.key).fetch(500)
team_medias = Media.query(Media.references == team.key).fetch(500)
robots = Robot.query(Robot.team == team.key).fetch()
district_teams = DistrictTeam.query(DistrictTeam.team == team.key).fetch()
years_participated = sorted(TeamParticipationQuery(team.key_name).fetch())
team_medias_by_year = {}
for media in team_medias:
if media.year in team_medias_by_year:
team_medias_by_year[media.year].append(media)
else:
team_medias_by_year[media.year] = [media]
media_years = sorted(team_medias_by_year.keys(), reverse=True)
self.template_values.update({
'event_teams': event_teams,
'team': team,
'team_media_years': media_years,
'team_medias_by_year': team_medias_by_year,
'robots': robots,
'district_teams': district_teams,
'years_participated': years_participated,
})
path = os.path.join(os.path.dirname(__file__), '../../templates/admin/team_details.html')
self.response.out.write(template.render(path, self.template_values))
示例2: get
# 需要导入模块: from models.robot import Robot [as 别名]
# 或者: from models.robot.Robot import query [as 别名]
def get(self, team_number):
self._require_admin()
team = Team.get_by_id("frc" + team_number)
event_teams = EventTeam.query(EventTeam.team == team.key).fetch(500)
team_medias = Media.query(Media.references == team.key).fetch(500)
robots = Robot.query(Robot.team == team.key).fetch()
district_teams = DistrictTeam.query(DistrictTeam.team == team.key).fetch()
team_medias_by_year = {}
for media in team_medias:
if media.year in team_medias_by_year:
team_medias_by_year[media.year].append(media)
else:
team_medias_by_year[media.year] = [media]
self.template_values.update({
'event_teams': event_teams,
'team': team,
'team_medias_by_year': team_medias_by_year,
'robots': robots,
'district_teams': district_teams,
})
path = os.path.join(os.path.dirname(__file__), '../../templates/admin/team_details.html')
self.response.out.write(template.render(path, self.template_values))
示例3: _query_async
# 需要导入模块: from models.robot import Robot [as 别名]
# 或者: from models.robot.Robot import query [as 别名]
def _query_async(self):
team_key = self._query_args[0]
robots = yield Robot.query(
Robot.team == ndb.Key(Team, team_key)).fetch_async()
raise ndb.Return(robots)