Updated Django converter

This commit is contained in:
Syrus Akbary 2016-08-15 23:27:41 -07:00
parent 5cb5d9d65a
commit bd41abcb5a
2 changed files with 9 additions and 2 deletions

View File

@ -94,7 +94,11 @@ def convert_onetoone_field_to_djangomodel(field, registry=None):
model = get_related_model(field) model = get_related_model(field)
def dynamic_type(): def dynamic_type():
return Field(registry.get_type_for_model(model)) _type = registry.get_type_for_model(model)
if not _type:
return
return Field(_type)
return Dynamic(dynamic_type) return Dynamic(dynamic_type)
@ -141,6 +145,9 @@ def convert_field_to_djangomodel(field, registry=None):
def dynamic_type(): def dynamic_type():
_type = registry.get_type_for_model(model) _type = registry.get_type_for_model(model)
if not _type:
return
return Field(_type, description=field.help_text) return Field(_type, description=field.help_text)
return Dynamic(dynamic_type) return Dynamic(dynamic_type)

View File

@ -43,7 +43,7 @@ class DjangoObjectTypeMeta(ObjectTypeMeta):
name=name, name=name,
description=attrs.pop('__doc__', None), description=attrs.pop('__doc__', None),
model=None, model=None,
fields=None, local_fields=None,
only_fields=(), only_fields=(),
exclude_fields=(), exclude_fields=(),
interfaces=(), interfaces=(),