Hi, I'm considering using graphql without relay. However, it seems like DjagnoFilterConnectionField is coupled with relay. I wish to not implement the base64 encoded <type>:<id> that relay.Node is using. Has anyone used graphene-django without relay yet?
After digging in into the code, I realized that it can be achieved with custom nodes. A follow up question:
class CustomNode(Node):
class Meta:
name = 'Node'
@staticmethod
def to_global_id(type, id):
return id
@staticmethod
def get_node_from_global_id(id, context, info, only_type=None):
# todo: fetch entity via model.objects.get
How do I get access to the right model on the resolver? Thanks!
Hi, I've found what I needed:
def get_node_from_global_id(id, context, info, only_type=None):
return info.return_type.graphene_type._meta.model.objects.get(id=id)
Closing issue :)
Can you provide full example code? What is thisNode you used?
Sorry I don't have an example code anymore. The Node class should be the one from the package graphene.
Most helpful comment
Hi, I've found what I needed:
Closing issue :)