当前位置: 首页>>代码示例>>Python>>正文


Python Robot.query方法代码示例

本文整理汇总了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))
开发者ID:MC42,项目名称:the-blue-alliance,代码行数:34,代码来源:admin_team_controller.py

示例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))
开发者ID:CarterFendley,项目名称:the-blue-alliance,代码行数:28,代码来源:admin_team_controller.py

示例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)
开发者ID:CarterFendley,项目名称:the-blue-alliance,代码行数:7,代码来源:robot_query.py


注:本文中的models.robot.Robot.query方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。