aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlban Gruin2017-11-25 20:43:21 +0100
committerAlban Gruin2017-11-25 20:43:21 +0100
commit4aebed8ca3f879aa4e2996620657a14ac9538477 (patch)
tree645005f9275000a7f1431bb9d901e6501552726f
parentd1191533a29b5f80543faa0758c7303d0a4b450c (diff)
get_week() convertit automatiquement les chaines de caractères en int
-rw-r--r--utils.py2
-rw-r--r--views.py2
2 files changed, 2 insertions, 2 deletions
diff --git a/utils.py b/utils.py
index e1b9867..63bcaed 100644
--- a/utils.py
+++ b/utils.py
@@ -30,7 +30,7 @@ def get_current_or_next_week():
def get_week(year, week):
start = timezone.make_aware(datetime.datetime.strptime(
- "{0}-W{1:02d}-1".format(year, week), "%Y-W%W-%w"))
+ "{0}-W{1:02d}-1".format(year, int(week)), "%Y-W%W-%w"))
end = start + datetime.timedelta(weeks=1)
return start, end
diff --git a/views.py b/views.py
index 9e88b3b..1269415 100644
--- a/views.py
+++ b/views.py
@@ -70,7 +70,7 @@ def timetable(request, year_slug, timetable_slug, group_slug, year=None, week=No
elif (int(year), int(week)) < (current_year, current_week):
is_old_timetable = True
- start, end = get_week(int(year), int(week))
+ start, end = get_week(year, week)
timetable = get_object_or_404(Timetable, year__slug=year_slug, slug=timetable_slug)
group = get_object_or_404(Group, slug=group_slug, timetable=timetable)