Beispiel #1
0
def updatelg_page(key = None):
    page = Turkah(dsn = app.config['dsn'])
    if request.method == 'GET':
        return page.open_updatelg(id = key)
    elif 'updategame' in request.form:
        playerone = request.form['playerone']
        playertwo = request.form['playertwo']
        result = request.form['result']
        return page.update_game(key, playerone, playertwo, result)
    else:
        return redirect(url_for('home_page'))
Beispiel #2
0
def updatelp_page(key = None):
    page = Turkah(dsn = app.config['dsn'])
    if request.method == 'GET':
        return page.open_updatelp(id = key)
    elif 'updateplayer' in request.form:
        name = request.form['name']
        surname = request.form['surname']
        win = request.form['win']
        lose = request.form['lose']
        draw = request.form['draw']
        return page.update_player(key, name, surname, win, lose, draw)
    else:
        return redirect(url_for('home_page'))
Beispiel #3
0
def localtour_page(key = None):
    page = Turkah(dsn = app.config['dsn'])
    if key == 1:
        return page.open_page("name")
    elif key == 2:
        return page.open_page("surname")
    elif key == 3:
        return page.open_page("win DESC")
    elif key == 4:
        return page.open_page("lose DESC")
    elif key == 5:
        return page.open_page("draw DESC")
    elif request.method == 'GET':
        try:
            return page.open_page()
        except:
            return page.init_table()
    elif 'initializeTable' in request.form:
        return page.init_table()
    elif 'addplayer' in request.form:
        name = request.form['name']
        surname = request.form['surname']
        win = request.form['win']
        lose = request.form['lose']
        draw = request.form['draw']
        return page.add_player(name, surname, win, lose, draw)
    elif 'addgame' in request.form:
        playerone = request.form['playerone']
        playertwo = request.form['playertwo']
        result = request.form['result']
        return page.add_game(playerone, playertwo, result)
    elif 'deleteplayer' in request.form:
        name = request.form['name']
        surname = request.form['surname']
        return page.delete_player(name, surname)
    elif 'deleteplayerwithid' in request.form:
        id = request.form['id']
        return page.delete_player_with_id(id)
    elif 'deletegame' in request.form:
        id = request.form['id']
        return page.delete_game(id)
    elif 'findplayer' in request.form:
        name = request.form['name']
        surname = request.form['surname']
        return page.find_player(name, surname)
    elif 'findplayerwithid' in request.form:
        id = request.form['id']
        return page.find_player_with_id(id)
    elif 'findgamebyid' in request.form:
        id = request.form['id']
        return page.find_game_by_id(id)
    elif 'findgamebyplayer' in request.form:
        id = request.form['id']
        return page.find_game_by_player(id)
    else:
        return redirect(url_for('home_page'))