Пример #1
0
def game(request, team1, team2, year, month, day):
    if team1 == team2:
        raise Http404
    team_year = calculate_team_year(year, month)
    team_1 = get_object_or_404(CollegeYear, college__slug=team1, season=team_year)
    team_2 = CollegeYear.objects.get(college__slug=team2, season=team_year)
    date = datetime.date(int(year), int(month), int(day))
    game = get_object_or_404(Game, team1=team_1, team2=team_2, date=date)
    t1_quarter_scores = None #QuarterScore.objects.filter(game=game, team=game.team1).order_by('quarter')
    t2_quarter_scores = None #QuarterScore.objects.filter(game=game, team=game.team2).order_by('quarter')
    if game.is_conference_game == True:
        conf = team_1.conference
    else:
        conf = CollegeYear.objects.none()
    try:
        game_offense = GameOffense.objects.get(game=game, team=team_1)
        fd = []
        fd.append(game_offense.first_downs_rushing)
        fd.append(game_offense.first_downs_passing)
        fd.append(game_offense.first_downs_penalty)
    except:
        game_offense = GameOffense.objects.none()
        fd = None
    try:
        game_defense = GameDefense.objects.get(game=game, team=team_1)
    except:
        game_defense = GameDefense.objects.none()
    try:
        drives = GameDrive.objects.get(game=game, team=team_1)
    except:
        drives = GameDrive.objects.none()
    try:
        player_rushing = PlayerRush.objects.filter(game=game, player__team=team_1).order_by('-net')
    except:
        player_rushing = PlayerRush.objects.none()
    try:
        player_passing = PlayerPass.objects.filter(game=game, player__team=team_1).order_by('-yards')
    except:
        player_passing = PlayerPass.objects.none()
    try:
        player_receiving = PlayerReceiving.objects.filter(game=game, player__team=team_1).order_by('-yards')
    except:
        player_receiving = PlayerReceiving.objects.none()
    try:
        player_tackles = PlayerTackle.objects.filter(game=game, player__team=team_1).order_by('-unassisted_tackles')[:5]
    except:
        player_tackles = PlayerTackle.objects.none()
    try:
        player_tacklesloss = PlayerTacklesLoss.objects.filter(game=game, player__team=team_1).order_by('-unassisted_tackles_for_loss')
    except:
        player_tacklesloss = PlayerTacklesLoss.objects.none()
    try:
        player_passdefense = PlayerPassDefense.objects.filter(game=game, player__team=team_1).order_by('-interceptions')
    except:
        player_passdefense = PlayerPassDefense.objects.none()
    return render_to_response('college/game.html', {'team_1': team_1, 'conf': conf, 'team_2': team_2, 'game': game, 'offense': game_offense, 'defense': game_defense, 'drives': drives, 'player_rushing': player_rushing, 'player_passing': player_passing, 'player_receiving':player_receiving, 'player_tackles':player_tackles, 'player_tacklesloss':player_tacklesloss, 'player_passdefense':player_passdefense, 'first_downs': fd, 't1_quarter_scores': t1_quarter_scores, 't2_quarter_scores': t2_quarter_scores })
Пример #2
0
def game_drive(request, team1, team2, year, month, day):
    team_year = calculate_team_year(year, month)
    team_1 = get_object_or_404(CollegeYear, college__slug=team1, season=team_year)
    try:
        team_2 = CollegeYear.objects.get(college__slug=team2, season=team_year)
        if team_1 == team_2:
            team_2 = CollegeYear.objects.none()
    except:
        team_2 = CollegeYear.objects.none()

    date = datetime.date(int(year), int(month), int(day))
    game = get_object_or_404(Game, team1=team_1, team2=team_2, date=date)
    drives = game.gamedrive_set.all()
    return render_to_response('college/game_drives.html', {'team_1': team_1, 'team_2': team_2, 'game': game, 'drives': drives })
Пример #3
0
def game_drive(request, team1, team2, year, month, day):
    team_year = calculate_team_year(year, month)
    team_1 = get_object_or_404(CollegeYear,
                               college__slug=team1,
                               season=team_year)
    try:
        team_2 = CollegeYear.objects.get(college__slug=team2, season=team_year)
        if team_1 == team_2:
            team_2 = CollegeYear.objects.none()
    except:
        team_2 = CollegeYear.objects.none()

    date = datetime.date(int(year), int(month), int(day))
    game = get_object_or_404(Game, team1=team_1, team2=team_2, date=date)
    drives = game.gamedrive_set.all()
    return render_to_response('college/game_drives.html', {
        'team_1': team_1,
        'team_2': team_2,
        'game': game,
        'drives': drives
    })
Пример #4
0
def game(request, team1, team2, year, month, day):
    if team1 == team2:
        raise Http404
    team_year = calculate_team_year(year, month)
    team_1 = get_object_or_404(CollegeYear,
                               college__slug=team1,
                               season=team_year)
    team_2 = CollegeYear.objects.get(college__slug=team2, season=team_year)
    date = datetime.date(int(year), int(month), int(day))
    game = get_object_or_404(Game, team1=team_1, team2=team_2, date=date)
    t1_quarter_scores = None  #QuarterScore.objects.filter(game=game, team=game.team1).order_by('quarter')
    t2_quarter_scores = None  #QuarterScore.objects.filter(game=game, team=game.team2).order_by('quarter')
    if game.is_conference_game == True:
        conf = team_1.conference
    else:
        conf = CollegeYear.objects.none()
    try:
        game_offense = GameOffense.objects.get(game=game, team=team_1)
        fd = []
        fd.append(game_offense.first_downs_rushing)
        fd.append(game_offense.first_downs_passing)
        fd.append(game_offense.first_downs_penalty)
    except:
        game_offense = GameOffense.objects.none()
        fd = None
    try:
        game_defense = GameDefense.objects.get(game=game, team=team_1)
    except:
        game_defense = GameDefense.objects.none()
    try:
        drives = GameDrive.objects.get(game=game, team=team_1)
    except:
        drives = GameDrive.objects.none()
    try:
        player_rushing = PlayerRush.objects.filter(
            game=game, player__team=team_1).order_by('-net')
    except:
        player_rushing = PlayerRush.objects.none()
    try:
        player_passing = PlayerPass.objects.filter(
            game=game, player__team=team_1).order_by('-yards')
    except:
        player_passing = PlayerPass.objects.none()
    try:
        player_receiving = PlayerReceiving.objects.filter(
            game=game, player__team=team_1).order_by('-yards')
    except:
        player_receiving = PlayerReceiving.objects.none()
    try:
        player_tackles = PlayerTackle.objects.filter(
            game=game, player__team=team_1).order_by('-unassisted_tackles')[:5]
    except:
        player_tackles = PlayerTackle.objects.none()
    try:
        player_tacklesloss = PlayerTacklesLoss.objects.filter(
            game=game,
            player__team=team_1).order_by('-unassisted_tackles_for_loss')
    except:
        player_tacklesloss = PlayerTacklesLoss.objects.none()
    try:
        player_passdefense = PlayerPassDefense.objects.filter(
            game=game, player__team=team_1).order_by('-interceptions')
    except:
        player_passdefense = PlayerPassDefense.objects.none()
    return render_to_response(
        'college/game.html', {
            'team_1': team_1,
            'conf': conf,
            'team_2': team_2,
            'game': game,
            'offense': game_offense,
            'defense': game_defense,
            'drives': drives,
            'player_rushing': player_rushing,
            'player_passing': player_passing,
            'player_receiving': player_receiving,
            'player_tackles': player_tackles,
            'player_tacklesloss': player_tacklesloss,
            'player_passdefense': player_passdefense,
            'first_downs': fd,
            't1_quarter_scores': t1_quarter_scores,
            't2_quarter_scores': t2_quarter_scores
        })