|
|
@ -12,7 +12,7 @@ from sqlalchemy import and_ |
|
|
|
|
|
|
|
|
|
|
|
from app import db |
|
|
|
from app import db |
|
|
|
from app.main import bp |
|
|
|
from app.main import bp |
|
|
|
from app.utils import generate_qr_code, serve_pil_image |
|
|
|
from app.utils import generate_qr_code, serve_pil_image, flash_errors |
|
|
|
from app.models import User, Game, Role, GamePlayer, GameState, Objective, ObjectiveMinimalEncoder,\ |
|
|
|
from app.models import User, Game, Role, GamePlayer, GameState, Objective, ObjectiveMinimalEncoder,\ |
|
|
|
LocationEncoder, PlayerCaughtPlayer, Review, Location |
|
|
|
LocationEncoder, PlayerCaughtPlayer, Review, Location |
|
|
|
from app.main.forms import CreateGameForm, ObjectiveForm, PlayerAddForm, UserCreateForm, \ |
|
|
|
from app.main.forms import CreateGameForm, ObjectiveForm, PlayerAddForm, UserCreateForm, \ |
|
|
@ -48,6 +48,8 @@ def create_game(): |
|
|
|
db.session.commit() |
|
|
|
db.session.commit() |
|
|
|
flash(f"'{game.name}' had been created!") |
|
|
|
flash(f"'{game.name}' had been created!") |
|
|
|
return redirect(url_for('main.game_dashboard', game_name=game.name)) |
|
|
|
return redirect(url_for('main.game_dashboard', game_name=game.name)) |
|
|
|
|
|
|
|
else: |
|
|
|
|
|
|
|
flash_errors(form) |
|
|
|
return render_template('create_game.html', title='Create Game', form=form) |
|
|
|
return render_template('create_game.html', title='Create Game', form=form) |
|
|
|
|
|
|
|
|
|
|
|
@bp.route('/game/<game_name>/change_settings', methods=['GET', 'POST']) |
|
|
|
@bp.route('/game/<game_name>/change_settings', methods=['GET', 'POST']) |
|
|
@ -85,6 +87,8 @@ def change_game_settings(game_name): |
|
|
|
db.session.commit() |
|
|
|
db.session.commit() |
|
|
|
flash(f"'{game.name}' had been updated!") |
|
|
|
flash(f"'{game.name}' had been updated!") |
|
|
|
return redirect(url_for('main.game_dashboard', game_name=game.name)) |
|
|
|
return redirect(url_for('main.game_dashboard', game_name=game.name)) |
|
|
|
|
|
|
|
else: |
|
|
|
|
|
|
|
flash_errors(form) |
|
|
|
return render_template('create_game.html', title='Chage Game Settings', form=form) |
|
|
|
return render_template('create_game.html', title='Chage Game Settings', form=form) |
|
|
|
|
|
|
|
|
|
|
|
@bp.route('/game/<game_name>/delete') |
|
|
|
@bp.route('/game/<game_name>/delete') |
|
|
|