Пример #1
0
def get_tourney_data():
    tourney_id        = request.args['tourney_id']
    pm                = PersistenceManager(myapp.db_connector)
    tourney           = pm.get_tourney_by_id(tourney_id)

    de = RankingEditor( pm, tourney )
    return de.get_json()
Пример #2
0
def edit_ranking_row():

    #see https://editor.datatables.net/manual/server
    tourney_id        = request.args['tourney_id']
    pm                = PersistenceManager(myapp.db_connector)
    tourney           = pm.get_tourney_by_id(tourney_id)

    de = RankingEditor(pm, tourney)

    event = Event(remote_address=myapp.remote_address(request),
                  event_date=func.now(),
                  event="edit ranking row")

    player_name = request.values['data[player_name]']
    player_name = decode(player_name)
    ret = de.set_and_get_json(request, player_name, event)
    event.event_details = event.event_details + " in tourney " + tourney.tourney_name
    pm.db_connector.get_session().add(event)
    pm.db_connector.get_session().commit()
    return ret