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


Python Team.name方法代码示例

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


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

示例1: accept_invitation

# 需要导入模块: from models import Team [as 别名]
# 或者: from models.Team import name [as 别名]
def accept_invitation(uname):
	user = user_manager.find_user_by_username(uname)
	if user.team_id:
		flash('This user has already formed a team with someone else. Please pick another teammate.', 'error')
		return redirect(url_for('user'))
	else:
		team = Team()
		team.members.append(current_user)
		team.members.append(user)
		team.name = current_user.username

		db.session.add(team)
		user.request_teammate = None
		current_user.request_teammate = None

		lst1 = db.session.query(User).filter(User.request_teammate==user.id).all()
		lst2 = db.session.query(User).filter(User.request_teammate==current_user.id).all()
		lst1.extend(lst2)

		for usr in lst1:
			usr.request_teammate = None
			send_mail(usr, 'fail_invitation')

		send_mail(user, 'new_team', u1=user, u2=current_user)
		send_mail(current_user, 'new_team', u1=user, u2=current_user)
		db.session.commit()

		team.name = "New Team No." + str(team.id)
		team.idea = Idea()
		db.session.commit()

		return redirect(url_for('team_page'))
开发者ID:berc-web,项目名称:berc_web,代码行数:34,代码来源:__init__.py

示例2: create_accepted_scrim

# 需要导入模块: from models import Team [as 别名]
# 或者: from models.Team import name [as 别名]
def create_accepted_scrim():
    from consts import UGC_PLATINUM
    from consts import SCRIM_ACCEPTED
    from datetime import datetime, timedelta
    
    team1 = Team()
    team1.name = "Team Test Finished Scrim1"
    team1.skill_level = UGC_PLATINUM
    team1.time_zone = "CET"
    db.session.add(team1)

    team2 = Team()
    team2.name = "Team Test Finished Scrim2"
    team2.skill_level = UGC_PLATINUM
    team2.time_zone = "CET"
    db.session.add(team2)

    now = datetime.utcnow()
    past_day = now - timedelta(days=now.weekday() - 4)

    scrim_accepted = Scrim()
    scrim_accepted.date     = past_day
    scrim_accepted.map1     = "Map1"
    scrim_accepted.map2     = "Map2"
    scrim_accepted.team1_id = team1.id
    scrim_accepted.team1    = team1
    scrim_accepted.team2_id = team2.id
    scrim_accepted.team2    = team2
    scrim_accepted.type     = "Accepted scrim"
    scrim_accepted.state    = SCRIM_ACCEPTED
    db.session.add(scrim_accepted)

    db.session.commit()

    return team1.id
开发者ID:gitter-badger,项目名称:scrimfinder,代码行数:37,代码来源:bots.py

示例3: validate

# 需要导入模块: from models import Team [as 别名]
# 或者: from models.Team import name [as 别名]
 def validate(self):
     rv = Form.validate(self)
     if not rv:
         return False
     current_time = int(time.time())
     if self.team_id.data:
         team = Team.query.get(self.team_id.data)
     else:
         team = Team()
     team.admin_id = self.admin_user.id
     team.name = self.name.data
     team.created_at = current_time
     if self.status.data:
         team.status = 1
     else:
         team.status = 0
     db.session.add(team)
     db.session.commit()
     if not self.team_id.data:
         team_user = TeamUser()
         team_user.team_id = team.id
         team_user.user_id = self.admin_user.id
         db.session.add(team_user)
         db.session.commit()
     if self.status.data:
         team_user = TeamUser.query.filter(db.and_(TeamUser.team_id == team.id and
                                                   TeamUser.user_id == self.admin_user.id)).first()
         if team_user:
             db.session.delete(team_user)
             db.session.commit()
         db.session.query(Project).filter(Project.team_id == team.id).update({Project.status: 1})
         db.session.commit()
     self.team = team
     return True
开发者ID:Red54,项目名称:Sophia,代码行数:36,代码来源:forms.py

示例4: register_team

# 需要导入模块: from models import Team [as 别名]
# 或者: from models.Team import name [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

示例5: save_model

# 需要导入模块: from models import Team [as 别名]
# 或者: from models.Team import name [as 别名]
 def save_model(self, request, obj, form, change):
     if not change:
         team = Team()
         team.name = obj.handle + " (Team)"
         team.save()
         obj.save()
         team.members.add(obj)
         team.save()
     else:
         obj.save()
开发者ID:codemaster,项目名称:PAXtourny,代码行数:12,代码来源:admin.py

示例6: init_teams

# 需要导入模块: from models import Team [as 别名]
# 或者: from models.Team import name [as 别名]
def init_teams():
    '''
    Initialize the Team table with the team names retrieved from Kimono.
    It removes all the entries and re-adds them.
    '''
    logger.info('Initializing teams...')
    url = settings.KIMONO['teams_url']
    teams = _get_results_collection1(url)
    teams_name = [team['name'] for team in teams]
    for team_name in teams_name:
        if not Team.objects.filter(name__iexact=team_name).exists():
            t = Team()
            t.name = team_name
            t.save()
开发者ID:brescia123,项目名称:fg-backend,代码行数:16,代码来源:db_manager.py

示例7: create_bot_teams

# 需要导入模块: from models import Team [as 别名]
# 或者: from models.Team import name [as 别名]
def create_bot_teams():
    """
    Create enough teams - all possible combinations of skill level, 
    time zone, scrim time, etc.
    """

    from consts import CHOICES_SKILLS, CHOICES_ZONES
    from utils import scrim_filter

    fake_name = '@_Team'

    for skill,_ in CHOICES_SKILLS:
        for time,_ in CHOICES_ZONES:
            combinations = scrim_filter.scrim_days_combinations('1111111')
            for scrim_days in combinations:
                bot_team = Team()
                bot_team.name = fake_name + '_' + str(skill) + '_' + str(time) + '_' + str(scrim_days)
                bot_team.skill_level = skill
                bot_team.time_zone = time
                bot_team.reputation = '42'
                bot_team.week_days = scrim_days
                db.session.add(bot_team)
    
    db.session.commit()
开发者ID:gitter-badger,项目名称:scrimfinder,代码行数:26,代码来源:bots.py

示例8: create_scrims

# 需要导入模块: from models import Team [as 别名]
# 或者: from models.Team import name [as 别名]
def create_scrims():

    from consts import UGC_PLATINUM
    from consts import SCRIM_PROPOSED, SCRIM_ACCEPTED, SCRIM_REJECTED, SCRIM_FINISHED
    from datetime import datetime, timedelta

    team1 = Team()
    team1.name = 'Scrim Team 1'
    team1.skill_level = UGC_PLATINUM
    team1.time_zone = "CET"
    db.session.add(team1)

    team2 = Team()
    team2.name = 'Scrim Team 2'
    team2.skill_level = UGC_PLATINUM
    team2.time_zone = "CET"
    db.session.add(team2)

    db.session.flush()

    now = datetime.utcnow()

    scrim_proposed = Scrim()
    scrim_proposed.date     = now
    scrim_proposed.map1     = 'Team Map1'
    scrim_proposed.team1_id = team1.id
    scrim_proposed.team1    = team1
    scrim_proposed.team2_id = team2.id
    scrim_proposed.team2    = team2
    scrim_proposed.type     = 'Proposed by Team 1'
    scrim_proposed.state    = SCRIM_PROPOSED
    db.session.add(scrim_proposed)

    another_day = now - timedelta(days=now.weekday() + 4)
    scrim_proposed2 = Scrim()
    scrim_proposed2.date     = another_day
    scrim_proposed2.map1     = 'Team Map2'
    scrim_proposed2.team1_id = team2.id
    scrim_proposed2.team1    = team2
    scrim_proposed2.team2_id = team1.id
    scrim_proposed2.team2    = team1
    scrim_proposed2.type     = 'Proposed by Team 2'
    scrim_proposed2.state    = SCRIM_PROPOSED
    db.session.add(scrim_proposed2)

    another_day = now - timedelta(days=now.weekday() + 3)
    scrim_accepted = Scrim()
    scrim_accepted.date     = another_day
    scrim_accepted.map1     = 'Team Map1'
    scrim_accepted.map2     = 'Team Map2'
    scrim_accepted.team1_id = team1.id
    scrim_accepted.team1    = team1
    scrim_accepted.team2_id = team2.id
    scrim_accepted.team2    = team2
    scrim_accepted.type     = 'Accepted by Team 2'
    scrim_accepted.state    = SCRIM_ACCEPTED
    db.session.add(scrim_accepted)

    another_day = now - timedelta(days=now.weekday() + 2)
    scrim_rejected = Scrim()
    scrim_rejected.date     = another_day
    scrim_rejected.map1     = 'Team Map1'
    scrim_rejected.map2     = 'Team Map2'
    scrim_rejected.team1_id = team1.id
    scrim_rejected.team1    = team1
    scrim_rejected.team2_id = team2.id
    scrim_rejected.team2    = team2
    scrim_rejected.type     = 'Rejected by Team 2'
    scrim_rejected.state    = SCRIM_REJECTED
    db.session.add(scrim_rejected)

    another_day = now - timedelta(days=now.weekday() + 1)
    scrim_finished = Scrim()
    scrim_finished.date     = another_day
    scrim_finished.map1     = 'Team Map1'
    scrim_finished.map2     = 'Team Map2'
    scrim_finished.team1_id = team1.id
    scrim_finished.team1    = team1
    scrim_finished.team2_id = team2.id
    scrim_finished.team2    = team2
    scrim_finished.type     = 'Won by Team 1'
    scrim_finished.result   = 'Won'
    scrim_finished.state    = SCRIM_FINISHED
    db.session.add(scrim_finished)

    db.session.commit()
开发者ID:gitter-badger,项目名称:scrimfinder,代码行数:88,代码来源:bots.py


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