Open
Description
Code
class ShipNode(DjangoObjectType):
class Meta:
model = Ship
filter_fields = ['id', 'size']
interfaces = (relay.Node, )
rowid = graphene.String()
@resolve_only_args
def resolve_rowid(self):
return self.id
class Query(object):
ship = relay.Node.Field(ShipNode)
all_ships = DjangoFilterConnectionField(ShipNode)
I have an id
field in my database which gets override when querying GraphQL server by the custom global ID. Using resolve_rowid
, I can get the id
I want, but I am unable to use it in the filters.
query {
ship(id: "124567") {
}
}
How can I filter based on my database's primary key instead of the global ID? How can I rename global ID from id
to _id
?