limit to start_date

This commit is contained in:
James Turk 2012-08-24 21:38:48 -04:00
parent ea06882aff
commit 71aadbfc93
2 changed files with 3 additions and 1 deletions

View File

@ -302,6 +302,7 @@ class MatchTeam(models.Model):
class League(models.Model):
name = models.CharField(max_length=100)
active = models.BooleanField(default=True)
start_date = models.DateField()
raw_picks = models.IntegerField(default=3)
smackdown_picks = models.IntegerField(default=3)
diva_picks = models.IntegerField(default=2)

View File

@ -113,7 +113,8 @@ def league(request, league_id):
belt_mapping = {'smackdown': 'ic', 'raw': 'us'}
# go over all events in order to determine belt holders
for event in Event.objects.all().order_by('date'):
for event in Event.objects.filter(date__gte=league.start_date
).order_by('date'):
# determine which belt is being competed for
belt_name = belt_mapping.get(event.name.lower(), 'world')
# get team scores for this event