Exemple #1
0
def sponsor_edit(profile, event, sponsor):
    if profile.userid not in g.user.user_organizations_owned_ids():
        abort(403)

    else:
        form = SponsorForm(obj=sponsor)
        if form.validate_on_submit():
            form.populate_obj(sponsor)
            sponsor.make_name()
            db.session.commit()
            flash(u"Your changes have been saved", 'success')
            return render_redirect(sponsor.url_for(), code=303)
        return render_form(form=form, title=u"Edit sponsor", submit=u"Save",
            cancel_url=sponsor.url_for(), ajax=True)
Exemple #2
0
def sponsor_edit(profile, event, sponsor):
    if profile.userid not in g.user.user_organizations_owned_ids():
        abort(403)

    else:
        form = SponsorForm(obj=sponsor)
        if form.validate_on_submit():
            form.populate_obj(sponsor)
            sponsor.make_name()
            db.session.commit()
            flash(u"Your changes have been saved", 'success')
            return render_redirect(sponsor.url_for(), code=303)
        return render_form(form=form, title=u"Edit sponsor", submit=u"Save",
            cancel_url=sponsor.url_for(), ajax=True)
Exemple #3
0
def sponsor_new(profile, event, form=None):
    if profile.userid not in g.user.user_organizations_owned_ids():
        abort(403)

    form = SponsorForm()
    if form.validate_on_submit():
        sponsor = Sponsor(event=event)
        form.populate_obj(sponsor)
        sponsor.make_name()
        db.session.add(sponsor)
        db.session.commit()
        flash("Sponsor added")
        return render_redirect(event.url_for(), code=303)
    return render_form(form=form, title=u"New Sponsor", submit=u"Save",
        cancel_url=event.url_for(), ajax=False)
Exemple #4
0
def sponsor_new(profile, event, form=None):
    if profile.userid not in g.user.user_organizations_owned_ids():
        abort(403)

    form = SponsorForm()
    if form.validate_on_submit():
        sponsor = Sponsor(event=event)
        form.populate_obj(sponsor)
        sponsor.make_name()
        db.session.add(sponsor)
        db.session.commit()
        flash("Sponsor added")
        return render_redirect(event.url_for(), code=303)
    return render_form(form=form, title=u"New Sponsor", submit=u"Save",
        cancel_url=event.url_for(), ajax=False)