Skip to content

Instantly share code, notes, and snippets.

@nidhinp
Last active September 5, 2019 06:48
Show Gist options
  • Save nidhinp/b89e8d6ac4c66293d143c88324595d49 to your computer and use it in GitHub Desktop.
Save nidhinp/b89e8d6ac4c66293d143c88324595d49 to your computer and use it in GitHub Desktop.
class Query(ObjectType):
authors = graphene.List(AuthorType)
# The field added for auther search with name
author_search = graphene.List(AuthorType, string=graphene.String())
def resolve_author_search(self, info, **kwargs):
string = kwargs.get("string", "")
return Author.objects.filter(name__icontains=string)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment