0

Here in relay tutorial they say:

Graphene creates globally unique IDs for all objects.
You may need to copy this value from the results of the first query

Those ids look like this SW5ncmVkaWVudE5vZGU6MQ==. And when querying a list of item in id field one can see that ids.

How can I get normal (int) ids? Or frontend should convert int ids into string ids?

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459

1 Answers1

2

Create a custom relay.Node class and override the from_global_id(...) method

from graphene import relay


class MyCustomNode(relay.Node):

    @classmethod
    def from_global_id(cls, global_id):
        return global_id
JPG
  • 82,442
  • 19
  • 127
  • 206