From b3ae74363e5b7700870dd5db1d636efc0d623305 Mon Sep 17 00:00:00 2001 From: Ernesto Rico Schmidt <ernesto@helsinki.at> Date: Fri, 14 Jan 2022 16:11:58 -0400 Subject: [PATCH] Make static methods of the TimeSlotManager timezone aware --- program/models.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/program/models.py b/program/models.py index 0e95c636..bb9daf67 100644 --- a/program/models.py +++ b/program/models.py @@ -1021,14 +1021,14 @@ class TimeSlotManager(models.Manager): @staticmethod def get_24h_timeslots(start): - end = start + timedelta(hours=24) + end = timezone.make_aware(start + timedelta(hours=24)) return TimeSlot.objects.filter(Q(start__lte=start, end__gte=start) | Q(start__gt=start, start__lt=end)).exclude(end=start) @staticmethod def get_7d_timeslots(start): - start = datetime.combine(start, time(0, 0)) + start = timezone.make_aware(datetime.combine(start, time(0, 0))) end = start + timedelta(days=7) return TimeSlot.objects.filter(Q(start__lte=start, end__gte=start) | -- GitLab