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


Python Team.name方法代码示例

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


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

示例1: create_team

# 需要导入模块: from models.Team import Team [as 别名]
# 或者: from models.Team.Team import name [as 别名]
def create_team():
    team = Team()
    team.name = "TestTeam"
    team.motto = "TestMotto"
    dbsession.add(team)
    dbsession.commit()
    return team
开发者ID:AdaFormacion,项目名称:RootTheBox,代码行数:9,代码来源:Helpers.py

示例2: create_team

# 需要导入模块: from models.Team import Team [as 别名]
# 或者: from models.Team.Team import name [as 别名]
    def create_team(self):
        ''' Admins can create teams manually '''
        try:
            name = self.get_argument('team_name', '')
            if Team.by_name(name) is not None:
                raise ValidationError("Team already exists")
            team = Team()
            team.name = self.get_argument('team_name', '')
            team.motto = self.get_argument('motto', '')
            if not self.config.banking:
                team.money = 0
            level_0 = GameLevel.by_number(0)
            if not level_0:
                level_0 = GameLevel.all()[0]
            team.game_levels.append(level_0)
            self.dbsession.add(team)
            self.dbsession.commit()

            # Avatar
            avatar_select = self.get_argument('team_avatar_select', '')
            if avatar_select and len(avatar_select) > 0:
                team._avatar = avatar_select
            elif hasattr(self.request, 'files') and 'avatar' in self.request.files:
                team.avatar = self.request.files['avatar'][0]['body']
            self.dbsession.add(team)
            self.dbsession.commit()
            self.redirect('/admin/users')
        except ValidationError as error:
            self.render("admin/create/team.html", errors=[str(error), ])
开发者ID:moloch--,项目名称:RootTheBox,代码行数:31,代码来源:AdminGameObjectHandlers.py

示例3: create_team

# 需要导入模块: from models.Team import Team [as 别名]
# 或者: from models.Team.Team import name [as 别名]
 def create_team(self):
     ''' Create a new team in the database '''
     team = Team()
     team.name = self.get_argument('team_name', '')
     team.motto = self.get_argument('motto', '')
     level_0 = GameLevel.all()[0]
     team.game_levels.append(level_0)
     self.dbsession.add(team)
     self.dbsession.commit()
     self.redirect('/admin/view/user_objects')
开发者ID:AdaFormacion,项目名称:RootTheBox,代码行数:12,代码来源:AdminHandlers.py

示例4: create_team

# 需要导入模块: from models.Team import Team [as 别名]
# 或者: from models.Team.Team import name [as 别名]
 def create_team(self):
     ''' Create a new team '''
     if self.config.public_teams:
         team = Team()
         team.name = self.get_argument('team_name', '')
         team.motto = self.get_argument('motto', '')
         level_0 = GameLevel.all()[0]
         team.game_levels.append(level_0)
         return team
     else:
         raise ValidationError("Public teams are not enabled")
开发者ID:WeiEast,项目名称:RootTheBox,代码行数:13,代码来源:PublicHandlers.py

示例5: create_team

# 需要导入模块: from models.Team import Team [as 别名]
# 或者: from models.Team.Team import name [as 别名]
 def create_team(self):
     ''' Create a new team '''
     if not self.config.teams:
         team = Team.by_name(self.get_argument('handle', ''))
         if team is None:
             team = Team()
             team.name = self.get_argument('handle', '')
         else:
             logging.info("Team %s already exists - Player Mode: reset team." % team.name)
             team.flags = []
             team.hints = []
             team.boxes = []
             team.items = []
             team.game_levels = []
             team.purchased_source_code = []
         team.motto = self.get_argument('motto', '')
         if self.config.banking:
             team.money = self.config.starting_team_money
         else:
             team.money = 0
         level_0 = GameLevel.by_number(0)
         if not level_0:
             level_0 = GameLevel.all()[0]
         team.game_levels.append(level_0)
         return team
     elif self.config.public_teams:
         if Team.by_name(self.get_argument('team_name', '')) is not None:
             raise ValidationError("This team name is already registered.  Use team code to join that team.")
         team = Team()
         team.name = self.get_argument('team_name', '')
         team.motto = self.get_argument('motto', '')
         if not self.config.banking:
             team.money = 0
         level_0 = GameLevel.by_number(0)
         if not level_0:
             level_0 = GameLevel.all()[0]
         team.game_levels.append(level_0)
         return team
     else:
         raise ValidationError("Public teams are not enabled")
开发者ID:moloch--,项目名称:RootTheBox,代码行数:42,代码来源:PublicHandlers.py

示例6: create_team

# 需要导入模块: from models.Team import Team [as 别名]
# 或者: from models.Team.Team import name [as 别名]
 def create_team(self):
     ''' Admins can create teams manually '''
     try:
         name = self.get_argument('team_name', '')
         motto = self.get_argument('motto', '')
         if Team.by_name(name) is not None:
             raise ValidationError("Team already exists")
         team = Team()
         team.name = self.get_argument('team_name', '')
         team.motto = self.get_argument('motto', '')
         level_0 = GameLevel.all()[0]
         self.dbsession.add(team)
         self.dbsession.commit()
         self.redirect('/admin/users')
     except ValidationError as error:
         self.render("admin/create/team.html", errors=[str(error), ])
开发者ID:AnarKyx01,项目名称:RootTheBox,代码行数:18,代码来源:AdminGameObjectHandlers.py


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