mbrochh / django-graphql-apollo-react-demo

Code for a workshop about my Django, GraphQL, ReactJS, Apollo-stack
332 stars 78 forks source link

update to code to resolve object pk's properly #5

Open mbrochh opened 7 years ago

mbrochh commented 7 years ago

something like this:

class ProductSizeType(DjangoObjectType):
    class Meta:
        model = models.ProductSize
        interfaces = (graphene.Node, )
        local_fields = {
            'pk': graphene.Field(graphene.Int),
        }

    def resolve_pk(self, args, context, info):
        return self.pk