Use explicit classmethod in simple mutation example

rel #1038
This commit is contained in:
Semyon Pupkov 2020-11-08 18:12:33 +05:00
parent 0888c748fd
commit dd5b1e7648

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()