2016-09-18 02:29:00 +03:00
|
|
|
from django.db import models
|
|
|
|
|
|
|
|
|
|
|
|
class MissingType(object):
|
|
|
|
pass
|
|
|
|
|
2016-11-15 09:34:49 +03:00
|
|
|
|
2016-09-18 02:29:00 +03:00
|
|
|
try:
|
2016-10-16 02:43:27 +03:00
|
|
|
DurationField = models.DurationField
|
2016-09-18 02:29:00 +03:00
|
|
|
UUIDField = models.UUIDField
|
|
|
|
except AttributeError:
|
|
|
|
# Improved compatibility for Django 1.6
|
2016-10-16 02:43:27 +03:00
|
|
|
DurationField = MissingType
|
2016-09-18 02:29:00 +03:00
|
|
|
UUIDField = MissingType
|
|
|
|
|
|
|
|
try:
|
|
|
|
from django.db.models.related import RelatedObject
|
|
|
|
except:
|
|
|
|
# Improved compatibility for Django 1.6
|
|
|
|
RelatedObject = MissingType
|
|
|
|
|
|
|
|
|
|
|
|
try:
|
|
|
|
# Postgres fields are only available in Django 1.8+
|
2016-11-15 10:07:45 +03:00
|
|
|
from django.contrib.postgres.fields import ArrayField, HStoreField, RangeField
|
2016-09-18 02:29:00 +03:00
|
|
|
except ImportError:
|
|
|
|
ArrayField, HStoreField, JSONField, RangeField = (MissingType, ) * 4
|
2016-11-15 10:07:45 +03:00
|
|
|
|
|
|
|
|
|
|
|
try:
|
|
|
|
# Postgres fields are only available in Django 1.9+
|
|
|
|
from django.contrib.postgres.fields import JSONField
|
|
|
|
except ImportError:
|
|
|
|
JSONField = MissingType
|