Skip to content

Commit

Permalink
fix(/tastypie/fields.py): Remove usage of datetime_safe module.
Browse files Browse the repository at this point in the history
  • Loading branch information
PK19982 committed Sep 2, 2023
1 parent 88e0218 commit b3e86fc
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions tastypie/fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
except ImportError:
from django.db.models.fields.related_descriptors import\
ReverseOneToOneDescriptor
from django.utils import datetime_safe

from tastypie.bundle import Bundle
from tastypie.exceptions import ApiFieldError, NotFound
Expand Down Expand Up @@ -351,7 +350,7 @@ def convert(self, value):
try:
year, month, day = value[:10].split('-')

return datetime_safe.date(int(year), int(month), int(day))
return datetime.date(int(year), int(month), int(day))
except ValueError:
raise ApiFieldError("Date provided to '%s' field doesn't appear to be a valid date string: '%s'" % (self.instance_name, value))

Expand Down Expand Up @@ -389,7 +388,7 @@ def convert(self, value):
year, month, day = value[:10].split('-')
hour, minute, second = value[11:19].split(':')

return make_aware(datetime_safe.datetime(int(year), int(month), int(day), int(hour), int(minute), int(second)))
return make_aware(datetime.datetime(int(year), int(month), int(day), int(hour), int(minute), int(second)))
except ValueError:
raise ApiFieldError("Datetime provided to '%s' field doesn't appear to be a valid datetime string: '%s'" % (self.instance_name, value))

Expand Down

0 comments on commit b3e86fc

Please sign in to comment.