Skip to content
Snippets Groups Projects

Resolve "Fix timezone handling with substitutions/amend dialog"

Merged Julian requested to merge 250-fix-timezone-handling-with-substitutions-amend-dialog into master
1 file
+ 0
22
Compare changes
  • Side-by-side
  • Inline
from datetime import timezone
import graphene
from graphene_django import DjangoObjectType
@@ -60,26 +58,6 @@ class LessonEventType(DjangoObjectType):
amends = graphene.Field(lambda: LessonEventType, required=False)
class DatetimeTimezoneMixin:
"""Handle datetimes for mutations with CalendarEvent objects.
This is necessary because the client sends timezone information as
ISO string which only includes an offset (+00:00 UTC) and an
offset is not a valid timezone. Instead we set UTC as timezone
here directly.
"""
@classmethod
def handle_datetime_start(cls, value, name, info) -> int:
value = value.replace(tzinfo=timezone.utc)
return value
@classmethod
def handle_datetime_end(cls, value, name, info) -> int:
value = value.replace(tzinfo=timezone.utc)
return value
class AmendLessonBatchCreateMutation(BaseBatchCreateMutation):
class Meta:
model = LessonEvent
Loading