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

@ -265,8 +265,21 @@ def convert_onetoone_field_to_djangomodel(field, registry=None):
_type = registry.get_type_for_model(model) _type = registry.get_type_for_model(model)
if not _type: if not _type:
return return
class CustomField(Field):
def wrap_resolve(self, parent_resolver):
resolver = super().wrap_resolve(parent_resolver)
return Field(_type, required=not field.null) 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) return Dynamic(dynamic_type)