本文整理汇总了Python中models.Team.idea方法的典型用法代码示例。如果您正苦于以下问题:Python Team.idea方法的具体用法?Python Team.idea怎么用?Python Team.idea使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类models.Team
的用法示例。
在下文中一共展示了Team.idea方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: accept_invitation
# 需要导入模块: from models import Team [as 别名]
# 或者: from models.Team import idea [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'))