Use explicit classmethod in simple mutation example (#1059)

rel #1038
This commit is contained in:
Semyon Pupkov 2020-11-09 22:06:53 +05:00 committed by GitHub
parent 0888c748fd
commit eb7a0265d8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -36,7 +36,8 @@ Simple example
# The class attributes define the response of the mutation
question = graphene.Field(QuestionType)
def mutate(self, info, text, id):
@classmethod
def mutate(cls, root, info, text, id):
question = Question.objects.get(pk=id)
question.text = text
question.save()