Skip to content

Commit

Permalink
Merge pull request #644 from drnlm/feature/drop_django_timezone_utc
Browse files Browse the repository at this point in the history
Feature/drop django timezone utc
  • Loading branch information
drnlm committed Sep 7, 2022
2 parents 484cdc4 + 68c5a60 commit 6f13c01
Show file tree
Hide file tree
Showing 5 changed files with 350 additions and 349 deletions.
11 changes: 5 additions & 6 deletions wafer/schedule/migrations/0009_migrate_to_datetimes.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import datetime

from django.db import migrations
from django.utils import timezone

def convert_day_to_schedule_block(apps, schema_editor):
"""For each Day, create a schedule block with the
Expand All @@ -22,14 +21,14 @@ def convert_day_to_schedule_block(apps, schema_editor):
day=day.date.day,
hour=0,
minute=0,
tzinfo=timezone.utc)
tzinfo=datetime.timezone.utc)
end_time = datetime.datetime(year=day.date.year,
month=day.date.month,
day=day.date.day,
hour=23,
minute=59,
second=59,
tzinfo=timezone.utc)
tzinfo=datetime.timezone.utc)
block = ScheduleBlock.objects.create(start_time=start_time,
end_time=end_time)
block.save()
Expand All @@ -55,15 +54,15 @@ def convert_slot_time_to_date_time(apps, schema_editor):
hour=slot.old_start_time.hour,
minute=slot.old_start_time.minute,
second=slot.old_start_time.second,
tzinfo=timezone.utc)
tzinfo=datetime.timezone.utc)
slot.start_time = new_start_time
new_end_time = datetime.datetime(year=day.date.year,
month=day.date.month,
day=day.date.day,
hour=slot.old_end_time.hour,
minute=slot.old_end_time.minute,
second=slot.old_end_time.second,
tzinfo=timezone.utc)
tzinfo=datetime.timezone.utc)
slot.end_time = new_end_time
slot.save()

Expand All @@ -80,7 +79,7 @@ def add_blocks_to_venues(apps, schema_editor):
day=day.date.day,
hour=0,
minute=0,
tzinfo=timezone.utc)
tzinfo=datetime.timezone.utc)
# Our earlier migration ensures this block exists
block = ScheduleBlock.objects.filter(
start_time__exact=start_time).first()
Expand Down

0 comments on commit 6f13c01

Please sign in to comment.