Beispiel #1
0
def PHDetail(dsn,id):
    playerH=playerHistory.playerHistory(dsn)
    if request.method == 'GET':
        now = datetime.datetime.now()
        datas= playerH.Select_PlayersHistory(id);
        ps=players.Players(dsn)
        ts=teams.Teams(dsn)
        tDatas=ts.select_teams()
        pDatas=ps.select_players()
        page= render_template('PHDetails.html', current_time=now.ctime(),
                              rows=datas, update = False,historyID=id,
                              PlayerSelect=pDatas,TeamSelect=tDatas,
                              )
        playerH.close_con();
        return page
    elif 'Delete' in request.form:
        keys = request.form.getlist('movies_to_delete')
        for key in keys:
            playerH.delete_History(key)
        playerH.close_con()
        return redirect(url_for('playerHistory',id=id))
    elif 'Add' in request.form:
        playerID=request.form['Player']
        teamID=request.form['Team']
        start=request.form['start']
        end=request.form['end']
        try:
            playerH.add_History(playerID,teamID,start,end)
        except dbapi2.DatabaseError:
            pass
        playerH.close_con()
        return redirect(url_for('playerHistory',id=id))
    elif 'Find' in request.form:
        print("*************************************************")
        now = datetime.datetime.now()
        team=request.form['FTeam']
        start=request.form['FStart']
        end=request.form['FEnd']
        datas= playerH.Find_PlayersHistory(id,team,start,end);
        ps=players.Players(dsn)
        ts=teams.Teams(dsn)
        tDatas=ts.select_teams()
        pDatas=ps.select_players()
        page= render_template('PHDetails.html', current_time=now.ctime(),
                              rows=datas, update = False,historyID=id,
                              PlayerSelect=pDatas,TeamSelect=tDatas
                              )
        playerH.close_con();
        return page
    elif 'Update' in request.form:
        keys = request.form.getlist('movies_to_delete')
        for key in keys:
           start=request.form['UStart'+key]
           end=request.form['UEnd'+key]
           playerH.Update_History(key, start, end)
        playerH.close_con()
        return redirect(url_for('playerHistory',id=id))
Beispiel #2
0
def InitPageFunc(dsn):
    for x in range(0, 2):
        playerTable = players.Players(dsn)
        playerTable.create_table()
        playerTable.close_con()
        userTable = users.Users(dsn)
        userTable.create_table()
        userTable.close_con()
        sponsorTable = sponsors.Sponsors(dsn)
        sponsorTable.create_table()
        sponsorTable.close_con()
        natTable = nats.Nats(dsn)
        natTable.create_table()
        natTable.close_con()
        statTable = stats.Stats(dsn)
        statTable.create_table()
        statTable.close_con()
        teamTable = teams.Teams(dsn)
        teamTable.create_table()
        teamTable.close_con()
        leagueTable = leagues.Leagues(dsn)
        leagueTable.create_table()
        leagueTable.close_con()
        coachTable = coaches.Coaches(dsn)
        coachTable.create_table()
        coachTable.close_con()
        stadiumTable = stadiums.Stadiums(dsn)
        stadiumTable.create_table()
        stadiumTable.close_con()
        matchTable = matches.Matches(dsn)
        matchTable.create_table()
        matchTable.close_con()
        betrateTable = betrates.Betrates(dsn)
        betrateTable.create_table()
        betrateTable.close_con()
        commentTable = comments.Comments(dsn)
        commentTable.create_table()
        commentTable.close_con()
        playerHis = playerHistory.playerHistory(dsn)
        playerHis.create_table()
        playerHis.close_con()
        outfittable = outfitTable.outfits(dsn)
        outfittable.create_table()
        outfittable.close_con()
        likeTable = likes.Likes(dsn)
        likeTable.create_table()
        likeTable.close_con()

    return HomePage.HomePageFunc()
Beispiel #3
0
def PHDetailUpdate(dsn,id):
    playerH=playerHistory.playerHistory(dsn)
    if request.method == 'GET':
        now = datetime.datetime.now()
        datas= playerH.Select_PlayersHistory(id);
        ps=players.Players(dsn)
        ts=teams.Teams(dsn)
        tDatas=ts.select_teams()
        pDatas=ps.select_players()
        page= render_template('PHDetails.html', current_time=now.ctime(),
                              rows=datas, update = True ,historyID=id,
                              PlayerSelect=pDatas,TeamSelect=tDatas,
                              )
        playerH.close_con();
        return page