mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-02-16 19:41:06 +03:00
added compat shim for utc/UTC
This commit is contained in:
parent
e2337e1072
commit
5436df54c6
|
@ -312,3 +312,12 @@ def set_many(instance, field, value):
|
||||||
else:
|
else:
|
||||||
field = getattr(instance, field)
|
field = getattr(instance, field)
|
||||||
field.set(value)
|
field.set(value)
|
||||||
|
|
||||||
|
|
||||||
|
try:
|
||||||
|
# A `utc` instance is available in Django 1.11+
|
||||||
|
from django.timezone import utc
|
||||||
|
except ImportError:
|
||||||
|
# A `UTC` class is available in older versions
|
||||||
|
from django.timezone import UTC
|
||||||
|
utc = UTC()
|
||||||
|
|
Loading…
Reference in New Issue
Block a user