mirror of
https://github.com/graphql-python/graphene.git
synced 2024-11-14 05:36:45 +03:00
25 lines
596 B
Python
25 lines
596 B
Python
|
from django.db import models
|
||
|
|
||
|
|
||
|
class MissingType(object):
|
||
|
pass
|
||
|
|
||
|
try:
|
||
|
UUIDField = models.UUIDField
|
||
|
except AttributeError:
|
||
|
# Improved compatibility for Django 1.6
|
||
|
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
|