Skip to content

Instantly share code, notes, and snippets.

@nidhinp
Created September 3, 2019 06:38
Show Gist options
  • Save nidhinp/ba6733baec55fe171ea14af0d33053b5 to your computer and use it in GitHub Desktop.
Save nidhinp/ba6733baec55fe171ea14af0d33053b5 to your computer and use it in GitHub Desktop.
import graphene
from graphene_django.types import DjangoObjectType, ObjectType
from ..models import Author, Book
class AuthorType(DjangoObjectType):
class Meta:
model = Author
class Query(ObjectType):
authors = graphene.List(AuthorType)
def resolve_authors(self, info, **kwargs):
return Author.objects.all()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment