fix leagues query

This commit is contained in:
James Turk 2012-05-29 01:08:33 -04:00
parent 548792c96e
commit b1138e6f6d
2 changed files with 3 additions and 7 deletions

View File

@ -9,7 +9,7 @@ from fowl.game.models import (Team, TeamPoints, Star, Event, League,
@login_required @login_required
def events(request, league_id): def events(request, league_id):
league = get_object_or_404(League, pk = league_id) league = get_object_or_404(League, pk = league_id)
leagues = League.objects.all() leagues = League.objects.filter(teams__login=request.user)
events = {} events = {}
points = TeamPoints.objects.filter(team__league_id=league_id).order_by( points = TeamPoints.objects.filter(team__league_id=league_id).order_by(
'match__id', 'team').select_related() 'match__id', 'team').select_related()
@ -83,7 +83,7 @@ def edit_event(request, event):
@login_required @login_required
def league(request, league_id): def league(request, league_id):
league = get_object_or_404(League, pk = league_id) league = get_object_or_404(League, pk = league_id)
leagues = League.objects.all() leagues = League.objects.filter(teams__login=request.user)
context = { context = {
'view': 'league', 'view': 'league',
'belts': ['ic', 'us', 'heavyweight', 'wwe'], 'belts': ['ic', 'us', 'heavyweight', 'wwe'],
@ -99,7 +99,7 @@ def league(request, league_id):
def roster(request, league_id): def roster(request, league_id):
league = get_object_or_404(League, pk = league_id) league = get_object_or_404(League, pk = league_id)
leagues = League.objects.all() leagues = League.objects.filter(teams__login=request.user)
context = { context = {
'stars': Star.objects.all(), 'stars': Star.objects.all(),
'view': 'roster', 'view': 'roster',

View File

@ -1,4 +0,0 @@
rm fowl.db
./manage.py syncdb
./manage.py loaddata testdata
echo "%run setup_league.py" | ./manage.py shell