graphene-django/graphene_django/compat.py
2016-10-15 16:43:27 -07:00

27 lines
669 B
Python

from django.db import models
class MissingType(object):
pass
try:
DurationField = models.DurationField
UUIDField = models.UUIDField
except AttributeError:
# Improved compatibility for Django 1.6
DurationField = MissingType
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+
from django.contrib.postgres.fields import ArrayField, HStoreField, JSONField, RangeField
except ImportError:
ArrayField, HStoreField, JSONField, RangeField = (MissingType, ) * 4