diff options
author | Alban Gruin | 2018-04-25 21:18:25 +0200 |
---|---|---|
committer | Alban Gruin | 2018-04-25 21:18:25 +0200 |
commit | 1789cbf1dcf555b35785e47237fb0a1f95720a45 (patch) | |
tree | e1645a307ee790bdd50751c8bde5694890e0257b /utils.py | |
parent | 81046d1e44380fd961efbc308a85d134f33d2bab (diff) | |
parent | 4c82869e3a590c982c43958e3e4b0f9fad440678 (diff) |
Merge branch 'futur'
Diffstat (limited to 'utils.py')
-rw-r--r-- | utils.py | 6 |
1 files changed, 6 insertions, 0 deletions
@@ -18,9 +18,11 @@ import re from django.utils import timezone + def get_current_week(): return tz_now().isocalendar()[:2] + def get_current_or_next_week(): year, week, day = tz_now().isocalendar() if day >= 6: @@ -28,6 +30,7 @@ def get_current_or_next_week(): return year, week + def get_week(year, week): start = timezone.make_aware(datetime.datetime.strptime( "{0}-W{1}-1".format(year, week), "%Y-W%W-%w")) @@ -35,6 +38,7 @@ def get_week(year, week): return start, end + def group_courses(courses): grouped_courses = [] for i, course in enumerate(courses): @@ -45,6 +49,7 @@ def group_courses(courses): return grouped_courses + def parse_group(name): # Explication de la regex # @@ -78,6 +83,7 @@ def parse_group(name): # une erreur. parts[4] devrait être une chaîne vide ici. return parts[0], None, parts[4] + def tz_now(): """Retourne la date et l’heure avec le bon fuseau horaire""" return timezone.make_aware(datetime.datetime.now()) |