mirror of
https://github.com/graphql-python/graphene-django.git
synced 2024-11-13 05:07:02 +03:00
35 lines
827 B
Python
35 lines
827 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, RangeField
|
|
except ImportError:
|
|
ArrayField, HStoreField, JSONField, RangeField = (MissingType, ) * 4
|
|
|
|
|
|
try:
|
|
# Postgres fields are only available in Django 1.9+
|
|
from django.contrib.postgres.fields import JSONField
|
|
except ImportError:
|
|
JSONField = MissingType
|