def player_edit(): form = PlayerEditForm(request.form) if form.player.data == None: return redirect(url_for("players_index")) player = form.player.data.id role = form.role.data status = form.play.data if request.form["btn"] == "Change": if role == "1": db.session().query(Player).filter(Player.id == player).update( {"top": status}) if role == "2": db.session().query(Player).filter(Player.id == player).update( {"jgl": status}) if role == "3": db.session().query(Player).filter(Player.id == player).update( {"mid": status}) if role == "4": db.session().query(Player).filter(Player.id == player).update( {"adc": status}) if role == "5": db.session().query(Player).filter(Player.id == player).update( {"sup": status}) if request.form["btn"] == "Remove player": db.session().query(Teammate).filter(Teammate.player == player).update( {"player": None}) db.session().query(Player).filter(Player.id == player).delete() db.session().commit() return redirect(url_for("players_index"))
def players_index_adc(): return render_template( "players/list.html", form=PlayerEditForm(), players=Player.query.filter(Player.adc == True), own_players=Player.query.filter(Player.account_id == current_user.id))
def players_index(): return render_template( "players/list.html", form=PlayerEditForm(), players=Player.query.order_by(Player.id).all(), own_players=Player.query.filter(Player.account_id == current_user.id))