コード例 #1
0
ファイル: PHDetail.py プロジェクト: itucsdb1514/itucsdb1514
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))
コード例 #2
0
ファイル: likeslist.py プロジェクト: itucsdb1514/itucsdb1514
def likesList(dsn):
    likeTable = likes.Likes(dsn)
    if request.method == 'GET':
        now = datetime.datetime.now()
        usersTable = users.Users(dsn)
        data2 = usersTable.select_users()
        playersTable = players.Players(dsn)
        data3 = playersTable.select_players()
        data = likeTable.select_Joint_Like()
        return render_template('likes.html',
                               current_time=now.ctime(),
                               rows=data,
                               update=False,
                               UsersSelect=data2,
                               PlayersSelect=data3)
    elif 'Delete' in request.form:
        keys = request.form.getlist('movies_to_delete')
        for key in keys:
            likeTable.delete_like(key)
        likeTable.close_con()
        return redirect(url_for('likesList'))
    elif 'Add' in request.form:
        user = request.form['SelectUserStatus']
        player = request.form['SelectPlayerStatus']
        status = request.form['Status']
        likeTable.add_like(user, player, status)
        likeTable.close_con()
        return redirect(url_for('likesList'))
    elif 'Update2' in request.form:
        keys = request.form.getlist('movies_to_delete')
        for key in keys:
            status = request.form['Status' + key]
            likeTable.update_like(key, status)
        likeTable.close_con()
        return redirect(url_for('likesListUpdate'))
    elif 'Find' in request.form:
        now = datetime.datetime.now()
        user = request.form['UserF']
        player = request.form['PlayerF']
        status = request.form['StatusF']
        data = likeTable.find_Joint_Like(user, player, status)
        usersTable = users.Users(dsn)
        data2 = usersTable.select_users()
        playersTable = players.Players(dsn)
        data3 = playersTable.select_players()
        temp = render_template('likes.html',
                               current_time=now.ctime(),
                               rows=data,
                               update=False,
                               UsersSelect=data2,
                               PlayersSelect=data3)
        likeTable.close_con()
        return temp
コード例 #3
0
def commentsList(dsn):
    commentTable = comments.Comments(dsn)
    if request.method == 'GET':
        now = datetime.datetime.now()
        playersTable = players.Players(dsn)
        data2 = playersTable.select_players()
        data = commentTable.select_Joint_Comment()
        return render_template('comments.html',
                               current_time=now.ctime(),
                               rows=data,
                               update=False,
                               PlayersSelect=data2)
    elif 'Delete' in request.form:
        keys = request.form.getlist('movies_to_delete')
        for key in keys:
            commentTable.delete_comment(key)
        commentTable.close_con()
        return redirect(url_for('commentsList'))
    elif 'Add' in request.form:
        player = request.form['SelectPlayerName']
        notes = request.form['Notes']
        point = request.form['Point']
        commentTable.add_comment(player, notes, point)
        commentTable.close_con()
        return redirect(url_for('commentsList'))
    elif 'Update2' in request.form:
        keys = request.form.getlist('movies_to_delete')
        for key in keys:
            notes = request.form['Notes' + key]
            point = request.form['Point' + key]
            commentTable.update_comment(key, notes, point)
        commentTable.close_con()
        return redirect(url_for('commentsListUpdate'))
    elif 'Find' in request.form:
        now = datetime.datetime.now()
        player = request.form['PlayerF']
        notes = request.form['NotesF']
        point = request.form['PointF']
        data = commentTable.find_Joint_Comment(player, notes, point)
        playersTable = players.Players(dsn)
        data2 = playersTable.select_players()
        temp = render_template('comments.html',
                               current_time=now.ctime(),
                               rows=data,
                               update=False,
                               PlayersSelect=data2)
        commentTable.close_con()
        return temp
コード例 #4
0
def natsList(dsn):
    natTable = nats.Nats(dsn)
    if request.method == 'GET':
        now = datetime.datetime.now()
        playersTable = players.Players(dsn)
        data2 = playersTable.select_players()
        data = natTable.select_Joint_Nat()
        return render_template('nats.html',
                               current_time=now.ctime(),
                               rows=data,
                               update=False,
                               PlayersSelect=data2)
    elif 'Delete' in request.form:
        keys = request.form.getlist('movies_to_delete')
        for key in keys:
            natTable.delete_nat(key)
        natTable.close_con()
        return redirect(url_for('natsList'))
    elif 'Add' in request.form:
        player = request.form['SelectPlayerName']
        nat = request.form['Nat']
        natTable.add_nat(player, nat)
        natTable.close_con()
        return redirect(url_for('natsList'))
    elif 'Update2' in request.form:
        keys = request.form.getlist('movies_to_delete')
        for key in keys:
            nat = request.form['Nat' + key]
            natTable.update_nat(key, nat)
        natTable.close_con()
        return redirect(url_for('natsListUpdate'))
    elif 'Find' in request.form:
        now = datetime.datetime.now()
        player = request.form['PlayerF']
        nat = request.form['NatF']
        data = natTable.find_Joint_Nat(player, nat)
        playersTable = players.Players(dsn)
        data2 = playersTable.select_players()
        temp = render_template('nats.html',
                               current_time=now.ctime(),
                               rows=data,
                               update=False,
                               PlayersSelect=data2)
        natTable.close_con()
        return temp
コード例 #5
0
def updatePlayersList(dsn):
    playerTable = players.Players(dsn)
    if request.method == 'GET':
        now = datetime.datetime.now()
        data = playerTable.select_players()
        temp = render_template('players.html',
                               current_time=now.ctime(),
                               rows=data,
                               update=True)
        playerTable.close_con()
        return temp
コード例 #6
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()
コード例 #7
0
ファイル: PHDetail.py プロジェクト: itucsdb1514/itucsdb1514
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
コード例 #8
0
def playersList(dsn):
    playerTable = players.Players(dsn)
    if request.method == 'GET':
        now = datetime.datetime.now()
        data = playerTable.select_players()
        return render_template('players.html',
                               current_time=now.ctime(),
                               rows=data,
                               update=False)
    elif 'Delete' in request.form:
        keys = request.form.getlist('movies_to_delete')
        for key in keys:
            playerTable.delete_player(key)
        playerTable.close_con()
        return redirect(url_for('playersList'))
    elif 'Add' in request.form:
        name = request.form['Name']
        country = request.form['Country']
        age = request.form['Age']
        playerTable.add_player(name, country, age)
        playerTable.close_con()
        return redirect(url_for('playersList'))
    elif 'Update2' in request.form:
        keys = request.form.getlist('movies_to_delete')
        for key in keys:
            name = request.form['Name' + key]
            country = request.form['Country' + key]
            age = request.form['Age' + key]
            playerTable.update_player(key, name, country, age)
        playerTable.close_con()
        return redirect(url_for('playersListUpdate'))
    elif 'Find' in request.form:
        now = datetime.datetime.now()
        name = request.form['NameF']
        country = request.form['CountryF']
        age = request.form['AgeF']
        data = playerTable.find_Players(name, country, age)
        temp = render_template('players.html',
                               current_time=now.ctime(),
                               rows=data,
                               update=False)
        playerTable.close_con()
        return temp