mirror of
https://github.com/encode/django-rest-framework.git
synced 2024-11-22 09:36:49 +03:00
added utc compat to fields
This commit is contained in:
parent
5717e853db
commit
bc3849bd59
|
@ -32,7 +32,7 @@ from django.utils.translation import ugettext_lazy as _
|
|||
|
||||
from rest_framework import ISO_8601
|
||||
from rest_framework.compat import (
|
||||
get_remote_field, unicode_repr, unicode_to_repr, value_from_object
|
||||
get_remote_field, unicode_repr, unicode_to_repr, value_from_object, utc
|
||||
)
|
||||
from rest_framework.exceptions import ErrorDetail, ValidationError
|
||||
from rest_framework.settings import api_settings
|
||||
|
@ -1104,7 +1104,7 @@ class DateTimeField(Field):
|
|||
if (field_timezone is not None) and not timezone.is_aware(value):
|
||||
return timezone.make_aware(value, field_timezone)
|
||||
elif (field_timezone is None) and timezone.is_aware(value):
|
||||
return timezone.make_naive(value, timezone.UTC())
|
||||
return timezone.make_naive(value, utc)
|
||||
return value
|
||||
|
||||
def default_timezone(self):
|
||||
|
|
Loading…
Reference in New Issue
Block a user