當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。