def org_edit(org): form = OrganizationForm(obj=org) form.name.description = app.config.get("ORG_NAME_REASON") form.title.description = app.config.get("ORG_TITLE_REASON") form.description.description = app.config.get("ORG_DESCRIPTION_REASON") if form.validate_on_submit(): form.populate_obj(org) db.session.commit() return render_redirect(url_for("org_info", name=org.name), code=303) return render_form(form=form, title="New Organization", formid="org_edit", submit="Save", ajax=False)
def org_edit(name): org = Organization.query.filter_by(name=name).first_or_404() if g.user not in org.owners.users: abort(403) form = OrganizationForm(obj=org) form.edit_obj = org if form.validate_on_submit(): form.populate_obj(org) db.session.commit() return render_redirect(url_for('org_info', name=org.name), code=303) return render_form(form=form, title="New Organization", formid="org_edit", submit="Save", ajax=False)
def org_new(): form = OrganizationForm() form.edit_obj = None if form.validate_on_submit(): org = Organization() form.populate_obj(org) org.owners.users.append(g.user) db.session.add(org) db.session.commit() return render_redirect(url_for('org_info', name=org.name), code=303) return render_form(form=form, title="New Organization", formid="org_new", submit="Create", ajax=False)
def org_new(): form = OrganizationForm() form.name.description = app.config.get("ORG_NAME_REASON") form.title.description = app.config.get("ORG_TITLE_REASON") form.description.description = app.config.get("ORG_DESCRIPTION_REASON") if form.validate_on_submit(): org = Organization() form.populate_obj(org) org.owners.users.append(g.user) db.session.add(org) db.session.commit() return render_redirect(url_for("org_info", name=org.name), code=303) return render_form(form=form, title="New Organization", formid="org_new", submit="Create", ajax=False)