summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErnesto Rico-Schmidt <e.rico.schmidt@gmail.com>2013-09-20 15:41:49 (GMT)
committerErnesto Rico-Schmidt <e.rico.schmidt@gmail.com>2013-09-20 15:41:49 (GMT)
commit1f76b988023df1520a3eb35dbecca72d0d693394 (patch)
tree2178abe912e69d970f2f21e6ca2fc3b4ccd369cc
parent1e7a2fd39f7cfa90e79fd9fbe00220de7f54520a (diff)
fix week number bug. this time for real. really
-rw-r--r--program/views.py14
1 files changed, 7 insertions, 7 deletions
diff --git a/program/views.py b/program/views.py
index 4b5737b..0e86518 100644
--- a/program/views.py
+++ b/program/views.py
@@ -91,7 +91,7 @@ def current_show(request):
def week_schedule(request, year=None, week=None):
if year is None and week is None:
- year, week = datetime.strftime(datetime.now(), '%Y__%V').split('__')
+ year, week = datetime.strftime(datetime.now(), '%G__%V').split('__')
monday = tofirstdayinisoweek(int(year), int(week))
tuesday = monday+timedelta(days=1)
@@ -113,12 +113,12 @@ def week_schedule(request, year=None, week=None):
extra_context['saturday_timeslots'] = TimeSlot.objects.get_day_timeslots(saturday)
extra_context['sunday_timeslots'] = TimeSlot.objects.get_day_timeslots(sunday)
- extra_context['last_w'] = datetime.strftime(monday-timedelta(days=7), '%Y/%V')
- extra_context['cur_w'] = '%s/%s' % (year, week)
- extra_context['next_w1'] = datetime.strftime(monday+timedelta(days=7), '%Y/%V')
- extra_context['next_w2'] = datetime.strftime(monday+timedelta(days=14), '%Y/%V')
- extra_context['next_w3'] = datetime.strftime(monday+timedelta(days=21), '%Y/%V')
- extra_context['next_w4'] = datetime.strftime(monday+timedelta(days=28), '%Y/%V')
+ extra_context['last_w'] = datetime.strftime(monday-timedelta(days=7), '%G/%V')
+ extra_context['cur_w'] = datetime.strftime(monday, '%G/%V')
+ extra_context['next_w1'] = datetime.strftime(monday+timedelta(days=7), '%G/%V')
+ extra_context['next_w2'] = datetime.strftime(monday+timedelta(days=14), '%G/%V')
+ extra_context['next_w3'] = datetime.strftime(monday+timedelta(days=21), '%G/%V')
+ extra_context['next_w4'] = datetime.strftime(monday+timedelta(days=28), '%G/%V')
return simple.direct_to_template(request, template='program/week_schedule.html', extra_context=extra_context)