Skip to content

Commit 1d6dfd4

Browse files
committed
Using start_date as a real date for FR
1 parent 182c44e commit 1d6dfd4

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

api/drf_views.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
from datetime import datetime
2+
from pytz import utc
13
from rest_framework.status import HTTP_201_CREATED, HTTP_200_OK
24
from rest_framework.generics import GenericAPIView, CreateAPIView, UpdateAPIView
35
from rest_framework.response import Response
@@ -821,6 +823,9 @@ def map_many_to_many_relations(self, data):
821823
if prop in data:
822824
del data[prop]
823825

826+
if 'start_date' in data:
827+
data['start_date'] = datetime.strptime(data['start_date'], '%Y-%m-%dT%H:%M:%S.%f%z')\
828+
.replace(tzinfo=utc)
824829
return data, locations, meta, partners
825830

826831
def save_locations(self, instance, locations, is_update=False):

0 commit comments

Comments
 (0)