From 716f9d836aece6051cf18f9060102873f3d2768d Mon Sep 17 00:00:00 2001 From: James Turk Date: Sun, 27 May 2012 21:22:28 -0400 Subject: [PATCH] commit stables improvements --- fowl/game/views.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/fowl/game/views.py b/fowl/game/views.py index 199096e..0a8ba24 100644 --- a/fowl/game/views.py +++ b/fowl/game/views.py @@ -1,6 +1,7 @@ from collections import defaultdict +from itertools import izip_longest from django.shortcuts import render, get_object_or_404 -from fowl.game.models import TeamPoints +from fowl.game.models import Team, TeamPoints def events(request): @@ -29,5 +30,9 @@ def edit_event(request, event_id=None): def stables(request): - context = {'belts':['ic', 'us', 'heavyweight', 'wwe']} + context = { 'belts': ['ic', 'us', 'heavyweight', 'wwe'] + } + teams = list(Team.objects.all().prefetch_related('stars')) + context['teams'] = teams + context['star_sets'] = izip_longest(*(team.stars.all() for team in teams)) return render(request, "stables.html", context)