added compat shim for utc/UTC

This commit is contained in:
Asif Saifuddin Auvi 2017-01-18 19:06:41 +06:00
parent e2337e1072
commit 5436df54c6

View File

@ -312,3 +312,12 @@ def set_many(instance, field, value):
else:
field = getattr(instance, field)
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()