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