fix for view w/ end date

This commit is contained in:
James Turk 2012-08-24 22:08:04 -04:00
parent 2fb2d23dab
commit da303edb04
2 changed files with 3 additions and 1 deletions

View File

@ -303,6 +303,7 @@ class League(models.Model):
name = models.CharField(max_length=100)
active = models.BooleanField(default=True)
start_date = models.DateField()
end_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.filter(date__gte=league.start_date
for event in Event.objects.filter(date__gte=league.start_date,
date__lte=league.end_date
).order_by('date'):
# determine which belt is being competed for
belt_name = belt_mapping.get(event.name.lower(), 'world')