def gigs(): form = GigForm() if form.validate_on_submit(): if form.gig_id.data: # Update existing app gig = Gig.query.get(form.gig_id.data) if not gig: flash("Failed to delete gig.") else: gig.date = form.date.data gig.time = form.time.data gig.location = form.location.data gig.band = form.band.data gig.details = form.details.data db.session.commit() flash("Updated!") form.reset() return redirect(url_for("admin.gigs")) else: # Create new gig = Gig( date=form.date.data, time=form.time.data, location=form.location.data, band=form.band.data, details=form.details.data, ) db.session.add(gig) db.session.commit() flash("Saved!") form.reset() return redirect(url_for("admin.gigs")) gigs = _fetch_gigs() return render_template("admin/gigs.html", gigs=gigs, form=form)
def gigs(): bio = _fetch_bio() gigs = _fetch_gigs() return render_template('gigs.html', gigs=gigs, tagline=bio.tagline)