Skip to content

Instantly share code, notes, and snippets.

@abhisuri97
Created November 27, 2017 00:34
Show Gist options
  • Save abhisuri97/ce5c537c2e6918484c22d4d8def4b539 to your computer and use it in GitHub Desktop.
Save abhisuri97/ce5c537c2e6918484c22d4d8def4b539 to your computer and use it in GitHub Desktop.
@club.route('/<int:club_id>/change-club-details', methods=['GET', 'POST'])
@login_required
@admin_required
def change_club_details(club_id):
club = Club.query.filter_by(id=club_id).first()
if club is None:
abort(404)
form = EditClubForm()
if form.validate_on_submit():
club.name = form.name.data
club.description = form.desc.data
club.categories = form.categories.data
club.is_confirmed = bool(form.is_confirmed.data)
db.session.add(club)
db.session.commit()
flash('Club successfully edited', 'form-success')
form.name.data = club.name
form.categories.data = club.categories
form.desc.data = club.description
form.is_confirmed.data = str(club.is_confirmed)
return render_template('club/manage_club.html', club=club, form=form)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment