|
|
|
@ -117,9 +117,19 @@ def add_player(game_name):
@@ -117,9 +117,19 @@ def add_player(game_name):
|
|
|
|
|
game.game_players.append(GamePlayer(player=player, role=Role[form_create.role.data])) |
|
|
|
|
db.session.commit() |
|
|
|
|
return redirect(url_for('game_dashboard', game_name=game.name)) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return render_template('add_player.html', title=f'Add Player for {game_name}', form_add=form_add, form_create=form_create, game=game) |
|
|
|
|
|
|
|
|
|
@app.route('/game/<game_name>/removeplayer/<player_name>') |
|
|
|
|
@login_required |
|
|
|
|
def remove_player(game_name, player_name): |
|
|
|
|
game = Game.query.filter_by(name=game_name).first_or_404() |
|
|
|
|
if not is_game_owner(game): abort(403) |
|
|
|
|
player = Player.query.filter(and_(Player.name == player_name, Player.games.contains(game))).first_or_404() |
|
|
|
|
game.players.remove(player) |
|
|
|
|
db.session.commit() |
|
|
|
|
return redirect(url_for('game_dashboard', game_name=game.name)) |
|
|
|
|
|
|
|
|
|
def generate_objective_qr_code(objective): |
|
|
|
|
qr = qrcode.QRCode( |
|
|
|
|
version=None, |
|
|
|
@ -163,7 +173,7 @@ def objective(objective_hash):
@@ -163,7 +173,7 @@ def objective(objective_hash):
|
|
|
|
|
|
|
|
|
|
@app.route('/objective/<objective_hash>/delete', methods=['GET']) |
|
|
|
|
@login_required |
|
|
|
|
def objective_delete(objective_hash): |
|
|
|
|
def delete_objective(objective_hash): |
|
|
|
|
objective = Objective.query.filter_by(hash = objective_hash).first_or_404() |
|
|
|
|
if not is_objective_owner(objective): abort(403) |
|
|
|
|
if is_objective_owner(objective): |
|
|
|
|