mirror of
https://github.com/graphql-python/graphene-django.git
synced 2024-11-23 01:57:08 +03:00
Handle async get_node
This commit is contained in:
parent
1b2d5e02e4
commit
0a84a6ea38
|
@ -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)
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user