-
-
Save abhisuri97/ce5c537c2e6918484c22d4d8def4b539 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@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