コード例 #1
0
ファイル: venue.py プロジェクト: blackhat06/hacknight
def venue_new():
    form = VenueForm()
    form.profile_id.choices = [(p.id, p.title) for p in g.user.profiles]
    if form.validate_on_submit():
        venue = Venue()
        form.populate_obj(venue)
        venue.make_name()
        db.session.add(venue)
        db.session.commit()
        flash(u"You have created a new venue", "success")
        return render_redirect(venue.url_for(), code=303)
    return render_form(form=form, title="New Venue", submit=u"Create", cancel_url=url_for('index'), ajax=False)
コード例 #2
0
ファイル: venue.py プロジェクト: d1on/hacknight
def venue_edit(venue):
    if not lastuser.has_permission('siteadmin') and venue.profile.userid not in g.user.user_organization_owned_ids():
        abort(403)
    form = VenueForm(obj=venue)
    form.profile_id.choices = [(p.id, p.title) for p in g.user.profiles]
    if form.validate_on_submit():
        form.populate_obj(venue)
        venue.make_name()
        db.session.commit()
        flash(u"You have edited details for venue %s" % venue.title, "success")
        return render_redirect(url_for('venue_view', venue=venue.name), code=303)
    return render_form(form=form, title="Edit Venue", submit=u"Save",
        cancel_url=url_for('venue_view', venue=venue.name), ajax=False)
コード例 #3
0
ファイル: venue.py プロジェクト: hasgeek/hacknight
def venue_new():
    form = VenueForm()
    form.profile_id.choices = [(p.id, p.title) for p in g.user.profiles]
    if request.method == "GET":
        form.timezone.data = app.config.get("TIMEZONE")
    if form.validate_on_submit():
        venue = Venue()
        form.populate_obj(venue)
        venue.make_name()
        db.session.add(venue)
        db.session.commit()
        flash(u"You have created a new venue", "success")
        return render_redirect(venue.url_for(), code=303)
    return render_form(form=form, title="New Venue", submit=u"Create", cancel_url=url_for("index"), ajax=False)
コード例 #4
0
ファイル: venue.py プロジェクト: sidharthkuruvila/hacknight
def venue_new():
    form = VenueForm()
    form.profile_id.choices = [(p.id, p.title) for p in g.user.profiles]
    if form.validate_on_submit():
        venue = Venue()
        form.populate_obj(venue)
        venue.make_name()
        db.session.add(venue)
        db.session.commit()
        flash(u"You have created a new venue", "success")
        return render_redirect(url_for('venue_view', venue=venue.name),
                               code=303)
    return render_form(form=form,
                       title="New Venue",
                       submit=u"Create",
                       cancel_url=url_for('venue_list'),
                       ajax=False)
コード例 #5
0
ファイル: venue.py プロジェクト: raj88iitr/hacknight
def venue_new():
    form = VenueForm()
    form.profile_id.choices = [(p.id, p.title) for p in g.user.profiles]
    if request.method == 'GET':
        form.timezone.data = app.config.get('TIMEZONE')
    if form.validate_on_submit():
        venue = Venue()
        form.populate_obj(venue)
        venue.make_name()
        db.session.add(venue)
        db.session.commit()
        flash(u"You have created a new venue", "success")
        return render_redirect(venue.url_for(), code=303)
    return render_form(form=form,
                       title="New Venue",
                       submit=u"Create",
                       cancel_url=url_for('index'),
                       ajax=False)
コード例 #6
0
ファイル: venue.py プロジェクト: raj88iitr/hacknight
def venue_edit(venue):
    if not (lastuser.has_permission('siteadmin')
            or venue.profile.userid in g.user.user_organizations_owned_ids()):
        abort(403)
    form = VenueForm(obj=venue)
    form.profile_id.choices = [(p.id, p.title) for p in g.user.profiles]
    form.profile_id.choices.insert(0, (venue.profile.id, venue.profile.title))
    if form.validate_on_submit():
        form.populate_obj(venue)
        venue.make_name()
        db.session.commit()
        flash(u"You have edited details for venue %s" % venue.title, "success")
        return render_redirect(url_for('venue_view', venue=venue.name),
                               code=303)
    return render_form(form=form,
                       title="Edit Venue",
                       submit=u"Save",
                       cancel_url=url_for('venue_view', venue=venue.name),
                       ajax=False)