Ejemplo n.º 1
0
def details(request, home_team, away_team, match_id, show_full=None):
    try:
        match = Matches.objects.get(pk=match_id)
        league = Leagues.objects.get(pk=match.league.id)
        squads = MatchSquad.objects.filter(match=match)
    except:
        raise Http404

    if match.status == "o":
        return render_to_response('matches/details_before.html', {
            'match': match,
            'league_table': league_table.render(league.id, match.home_team_id, match.away_team_id),
            'squads': squads,
            'last5_home': last_matches.render_team(match.home_team.id, 5, True),
            'last5_away': last_matches.render_team(match.away_team.id, 5, True),
            'menu': menu.render(request, 'matches', 'details', {'match_id': match_id}, True),
        }, context_instance=RequestContext(request))

    else:
        template = 'matches/details.html'
        if show_full == "images":
            template = 'matches/show_images.html'
        elif show_full == "videos":
            template = 'matches/show_videos.html'
        elif show_full == "comments":
            template = 'matches/show_comments.html'
        elif show_full == "analysis":
            template = 'matches/show_analysis.html'

        return render_to_response(template, {
            'match': match,
            'squads': squads,
            'menu': menu.render(request, 'matches', 'details', {'match_id': match_id}, True),
        }, context_instance=RequestContext(request))
Ejemplo n.º 2
0
def details(request, team_name, season="2007-2008"):
    team = get_object_or_404(Teams, name_en_url=team_name)
    # season = get_object_or_404(Seasons, url=season)

    return render_to_response("teams/details.html", {
        'team': team,
        'teams_news': related_news.render_team(team.id),
        'team_news_most_popular': related_news.most_popular_team(team.id),
        'league_table': league_table.render(team.current_league_id, team.id),
        'results': last_matches.render_team(team.id),
        'live_fixtures': render_live_fixtures(team_id=team.id),
        'menu': menu.render(request, 'index', 'index', {}, True)}, RequestContext(request, {}))
Ejemplo n.º 3
0
def latest_matches(team_id):
    from myscore.main.modules.matches import last_matches

    return {"render": last_matches.render_team(team_id)}