Apollo and graphene

Get real id of item in Django and GraphQL


When you use graphql in django using graphen and when you utilize the relay and nodes, the query result of any item while have base64 representation of the id,

You can fix that easily by subclassing from “relay.Node” and then just use the new class in the interface like in the code below:

use this code in your schema.py file.

ps: when you want to request an item by its id you gonna need to use its base64 id or use custom resolve to request it by its id.



, ,



اترك تعليقاً

لن يتم نشر عنوان بريدك الإلكتروني. الحقول الإلزامية مشار إليها بـ *