Handle async get_node

This commit is contained in:
Josh Warwick 2023-04-01 19:16:12 -07:00
parent 1b2d5e02e4
commit 0a84a6ea38

View File

@ -266,7 +266,20 @@ def convert_onetoone_field_to_djangomodel(field, registry=None):
if not _type:
return
return Field(_type, required=not field.null)
class CustomField(Field):
def wrap_resolve(self, parent_resolver):
resolver = super().wrap_resolve(parent_resolver)
try:
get_running_loop()
except RuntimeError:
pass
else:
resolver=sync_to_async(resolver)
return resolver
return CustomField(_type, required=not field.null)
return Dynamic(dynamic_type)