context = super(ProgramView, self).get_context_data(**kwargs)
context['sectionName'] = "emissions"
schedules = Schedule.objects.select_related().order_by('datetime')
- week = int(week)
- year = int(year)
days = []
for day in range(7):
days.append({'schedules': [x for x in schedules if x.is_on_weekday(day+1)],
'datetime': datetime(2007, 1, day+1)})
context['days'] = days
context['weekday'] = datetime.today().weekday()
- context['week'] = week if week is not None else datetime.today().isocalendar()[1]-1
- context['week'] = week if week is not None else datetime.today().isocalendar()[1]-1
- context['year'] = year if year is not None else datetime.today().year
+ context['week'] = week = int(week) if week is not None else datetime.today().isocalendar()[1]-1
+ context['year'] = year = int(year) if year is not None else datetime.today().year
context['week_first_day'] = datetime.strptime(str(year)+' '+str(week)+' 1', '%Y %U %w')
context['week_last_day'] = context['week_first_day'] + timedelta(days=+6)
context['week_previous'] = context['week_first_day'] + timedelta(days=-7)