def team_delete(org, team): if team == org.owners: abort(403) if request.method == 'POST': team_data_changed.send(team, changes=['delete'], user=g.user) return render_delete_sqla(team, db, title=u"Confirm delete", message=u"Delete team '%s'?" % team.title, success=u"You have deleted team '%s' from organization '%s'." % (team.title, org.title), next=url_for('.org_info', name=org.name))
def team_delete(org, team): if team == org.owners or team == org.members: abort(403) if request.method == 'POST': team_data_changed.send(team, changes=['delete'], user=g.user) return render_delete_sqla(team, db, title=_(u"Confirm delete"), message=_(u"Delete team {title}?").format(title=team.title), success=_(u"You have deleted team ‘{team}’ from organization ‘{org}’").format(team=team.title, org=org.title), next=url_for('.org_info', name=org.name))
def team_edit(org, team): form = TeamForm(obj=team) if form.validate_on_submit(): form.populate_obj(team) db.session.commit() team_data_changed.send(team, changes=['edit'], user=g.user) return render_redirect(url_for('.org_info', name=org.name), code=303) return render_form(form=form, title=_(u"Edit team: {title}").format(title=team.title), formid='team_edit', submit=_("Save"), ajax=False)
def team_new(org): form = TeamForm() if form.validate_on_submit(): team = Team(org=org) db.session.add(team) form.populate_obj(team) db.session.commit() team_data_changed.send(team, changes=['new'], user=g.user) return render_redirect(url_for('.org_info', name=org.name), code=303) return render_form(form=form, title=_(u"Create new team"), formid='team_new', submit=_("Create"))
def team_edit(org, team): form = TeamForm(obj=team) if request.method == 'GET': form.users.data = [u.userid for u in team.users] if form.validate_on_submit(): team.title = form.title.data if form.users.data: team.users = User.query.filter(User.userid.in_(form.users.data)).all() db.session.commit() team_data_changed.send(team, changes=['edit'], user=g.user) return render_redirect(url_for('.org_info', name=org.name), code=303) return make_response(render_template('edit_team.html', form=form, title=u"Edit team: %s" % team.title, formid='team_edit', submit="Save", ajax=False))
def team_new(org): form = TeamForm() if form.validate_on_submit(): team = Team(org=org) team.title = form.title.data if form.users.data: team.users = User.query.filter(User.userid.in_(form.users.data)).all() db.session.add(team) db.session.commit() team_data_changed.send(team, changes=['new'], user=g.user) return render_redirect(url_for('.org_info', name=org.name), code=303) return make_response(render_template('edit_team.html', form=form, title=u"Create new team", formid='team_new', submit="Create"))
def team_delete(org, team): if team == org.owners or team == org.members: abort(403) if request.method == 'POST': team_data_changed.send(team, changes=['delete'], user=g.user) return render_delete_sqla( team, db, title=_(u"Confirm delete"), message=_(u"Delete team {title}?").format(title=team.title), success=_(u"You have deleted team ‘{team}’ from organization ‘{org}’" ).format(team=team.title, org=org.title), next=url_for('.org_info', name=org.name))
def team_delete(org, team): if team == org.owners: abort(403) if request.method == 'POST': team_data_changed.send(team, changes=['delete'], user=g.user) return render_delete_sqla( team, db, title=u"Confirm delete", message=u"Delete team '%s'?" % team.title, success=u"You have deleted team '%s' from organization '%s'." % (team.title, org.title), next=url_for('.org_info', name=org.name))
def edit(self): form = TeamForm(obj=self.obj) if form.validate_on_submit(): form.populate_obj(self.obj) db.session.commit() team_data_changed.send(self.obj, changes=['edit'], user=current_auth.user) return render_redirect(self.obj.org.url_for(), code=303) return render_form( form=form, title=_(u"Edit team: {title}").format(title=self.obj.title), formid='team_edit', submit=_("Save"), ajax=False)
def new_team(self): form = TeamForm() if form.validate_on_submit(): team = Team(org=self.obj) db.session.add(team) form.populate_obj(team) db.session.commit() team_data_changed.send(team, changes=['new'], user=current_auth.user) return render_redirect(self.obj.url_for('view'), code=303) return render_form(form=form, title=_(u"Create new team"), formid='new_team', submit=_("Create"))
def delete(self): if self.obj == self.obj.org.owners or self.obj == self.obj.org.members: abort(403) if request.method == 'POST': team_data_changed.send(self.obj, changes=['delete'], user=current_auth.user) return render_delete_sqla( self.obj, db, title=_(u"Confirm delete"), message=_(u"Delete team {title}?").format(title=self.obj.title), success=_( u"You have deleted team ‘{team}’ from organization ‘{org}’"). format(team=self.obj.title, org=self.obj.org.title), next=self.obj.org.url_for())
def team_new(org): form = TeamForm() if form.validate_on_submit(): team = Team(org=org) team.title = form.title.data if form.users.data: team.users = User.query.filter(User.userid.in_( form.users.data)).all() db.session.add(team) db.session.commit() team_data_changed.send(team, changes=['new'], user=g.user) return render_redirect(url_for('.org_info', name=org.name), code=303) return make_response( render_template('edit_team.html', form=form, title=u"Create new team", formid='team_new', submit="Create"))
def team_edit(org, team): form = TeamForm(obj=team) if request.method == 'GET': form.users.data = [u.userid for u in team.users] if form.validate_on_submit(): team.title = form.title.data if form.users.data: team.users = User.query.filter(User.userid.in_( form.users.data)).all() db.session.commit() team_data_changed.send(team, changes=['edit'], user=g.user) return render_redirect(url_for('.org_info', name=org.name), code=303) return make_response( render_template(u'edit_team.html', form=form, title=u"Edit team: {title}".format(title=team.title), formid='team_edit', submit="Save", ajax=False))