def fplayers(): with dbapi2.connect(app.config['dsn']) as connection: _playerList = dbmanager.getPlayers(connection) _sponsorList = dbmanager.getSponsor(connection) _channelList = dbmanager.getChannels(connection) _info = layoutInfo('The game of snooker has been everything to me.','RONNIE O-SULLIVAN','static/img/players.jpg') return render_template('fplayers.html', playerList = _playerList, info = _info, sponsorList = _sponsorList, channelList = _channelList)
def player(): with dbapi2.connect(app.config['dsn']) as connection: if(request.method == 'GET'): _playerList = dbmanager.getPlayers(connection) return render_template('player.html', playerList = _playerList) if(request.form["action"] == "add_player_action"): dbmanager.addPlayer(request.form['add_firstname'], request.form['add_lastname'], int(request.form['add_age']), request.form['add_gender'],request.form['add_email'],request.form['add_nationality'],request.form['add_turned_pro'],request.form['add_location'],request.form['add_nickname'],request.form['add_money_list_earnings'],request.form['add_birthday'], connection) return redirect(url_for('player')) if(request.form["action"] == "delete_player_action"): dbmanager.deletePlayer(request.form['id'], connection) return redirect(url_for('player'))