예제 #1
0
def ftournaments():
    with dbapi2.connect(app.config['dsn']) as connection:
        _tourList = dbmanager.getTournaments(connection)
        _sponsorList = dbmanager.getSponsor(connection)
        _channelList = dbmanager.getChannels(connection)
        _info = layoutInfo('Snooker is about having the best offensive play possible.','RONNIE O-SULLIVAN','static/img/players.jpg')
        return render_template('ftournament.html', tournamentList = _tourList, info = _info, sponsorList = _sponsorList, channelList = _channelList)
예제 #2
0
def tournament():
    with dbapi2.connect(app.config['dsn']) as connection:
        if(request.method == 'GET'):
            _tournamentList = dbmanager.getTournaments(connection)
            return render_template('tournament.html', tournamentList = _tournamentList)

        if(request.form["action"] == "add_sponsor_action"):
            dbmanager.addTournament(request.form['add_name'], request.form['add_venueName'], request.form['add_round'],request.form['add_player_count'], request.form['add_lastWinnerName'], request.form['add_awardName'], connection)
            return redirect(url_for('tournament'))

        if(request.form["action"] == "delete_sponsor_action"):
            dbmanager.deleteTournament(request.form['id'], connection)
            return redirect(url_for('tournament'))

        return render_template('tournament.html')