Skip to content

Commit 712d57e

Browse files
committed
Delete RelatedObject import
1 parent 7fd6125 commit 712d57e

File tree

2 files changed

+2
-23
lines changed

2 files changed

+2
-23
lines changed

graphene_django/converter.py

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@
99
from graphene.utils.str_converters import to_camel_case, to_const
1010
from graphql import assert_valid_name
1111

12-
from .compat import (ArrayField, HStoreField, JSONField, RangeField,
13-
RelatedObject)
12+
from .compat import ArrayField, HStoreField, JSONField, RangeField
1413
from .fields import get_connection_field, DjangoListField
1514
from .utils import get_related_model, import_single_dispatch
1615

@@ -157,26 +156,6 @@ def dynamic_type():
157156
return Dynamic(dynamic_type)
158157

159158

160-
# For Django 1.6
161-
@convert_django_field.register(RelatedObject)
162-
def convert_relatedfield_to_djangomodel(field, registry=None):
163-
model = field.model
164-
165-
def dynamic_type():
166-
_type = registry.get_type_for_model(model)
167-
if not _type:
168-
return
169-
170-
if isinstance(field.field, models.OneToOneField):
171-
return Field(_type)
172-
173-
if is_node(_type):
174-
return get_connection_field(_type)
175-
return DjangoListField(_type)
176-
177-
return Dynamic(dynamic_type)
178-
179-
180159
@convert_django_field.register(models.OneToOneField)
181160
@convert_django_field.register(models.ForeignKey)
182161
def convert_field_to_djangomodel(field, registry=None):

graphene_django/tests/test_converter.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
from graphene.types.datetime import DateTime, Time
99
from graphene.types.json import JSONString
1010

11-
from ..compat import JSONField, RelatedObject
11+
from ..compat import JSONField
1212
from ..converter import convert_django_field, convert_django_field_with_choices
1313
from ..registry import Registry
1414
from ..types import DjangoObjectType

0 commit comments

Comments
 (0)