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


Python Team.key方法代码示例

本文整理汇总了Python中models.Team.key方法的典型用法代码示例。如果您正苦于以下问题:Python Team.key方法的具体用法?Python Team.key怎么用?Python Team.key使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在models.Team的用法示例。


在下文中一共展示了Team.key方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: get

# 需要导入模块: from models import Team [as 别名]
# 或者: from models.Team import key [as 别名]
 def get(self, first_eid):
     df = DatafeedUsfirstEvents()
     
     event = df.getEvent(first_eid)
     event = EventUpdater.createOrUpdate(event)
     
     teams = df.getEventRegistration(first_eid)
     eventteams_count = 0
     for team_dict in teams:
         # This could be refactored to do a lot fewer DB requests by batching the Team and EventTeam gets.
         # -gregmarra 5 Dec 2010
         team = Team.get_by_key_name("frc" + str(team_dict["number"]))
         if team is None:
             team = Team(
                 team_number = int(team_dict["number"]),
                 first_tpid = int(team_dict["tpid"]),
                 key_name = "frc" + str(team_dict["number"])
             )
             team.put()
         
         et = EventTeam.get_or_insert(
             key_name = event.key().name() + "_" + team.key().name(),
             event = event,
             team = team)
         eventteams_count = eventteams_count + 1
     
     template_values = {
         'event': event,
         'eventteams_count': eventteams_count,
     }
     
     path = os.path.join(os.path.dirname(__file__), '../templates/datafeeds/usfirst_event_get.html')
     self.response.out.write(template.render(path, template_values))
开发者ID:Apple101Review,项目名称:the-blue-alliance,代码行数:35,代码来源:datafeed_controller.py

示例2: register_team

# 需要导入模块: from models import Team [as 别名]
# 或者: from models.Team import key [as 别名]
def register_team(request):
    serialized = TeamSerializer(data=request.DATA)

    team = Team()
    team.name = serialized.init_data['name']
    team.email = serialized.init_data['email']
    team.key = "something"
    team.save()

    return Response(TeamSerializer(team).data, status=status.HTTP_201_CREATED)
开发者ID:UFAL-DSG,项目名称:teyb,代码行数:12,代码来源:views.py


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