def team_edit(org, team): form = TeamForm(obj=team) if form.validate_on_submit(): form.populate_obj(team) db.session.commit() return render_redirect(url_for("org_info", name=org.name), code=303) return render_form(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) form.populate_obj(team) db.session.add(team) db.session.commit() 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", ajax=False)
def team_edit(name, userid): org = Organization.query.filter_by(name=name).first_or_404() if g.user not in org.owners.users: abort(403) team = Team.query.filter_by(org=org, userid=userid).first_or_404() form = TeamForm(obj=team) form.edit_obj = team if form.validate_on_submit(): form.populate_obj(team) db.session.commit() return render_redirect(url_for('org_info', name=org.name), code=303) return render_form(form=form, title=u"Edit team: %s" % team.title, formid='team_edit', submit="Save", ajax=False)
def team_new(name): org = Organization.query.filter_by(name=name).first_or_404() if g.user not in org.owners.users: abort(403) form = TeamForm() if form.validate_on_submit(): team = Team(org=org) form.populate_obj(team) db.session.add(team) db.session.commit() 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", ajax=False)