mirror of
https://github.com/graphql-python/graphene-django.git
synced 2025-04-25 19:43:51 +03:00
Update mutations.rst
I believe the `[1]` was ommitted from the `from_global_id` call as that method returns a tuple of type and id, of which we're only interested in the id here. Took me half a day to figure out why this code wasn't working today. See function def here: https://github.com/graphql-python/graphql-relay-py/blob/master/graphql_relay/node/node.py#L67
This commit is contained in:
parent
0916e03cb3
commit
fc49a50cc3
|
@ -214,7 +214,7 @@ You can use relay with mutations. A Relay mutation must inherit from
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def mutate_and_get_payload(cls, root, info, text, id):
|
def mutate_and_get_payload(cls, root, info, text, id):
|
||||||
question = Question.objects.get(pk=from_global_id(id))
|
question = Question.objects.get(pk=from_global_id(id)[1])
|
||||||
question.text = text
|
question.text = text
|
||||||
question.save()
|
question.save()
|
||||||
return QuestionMutation(question=question)
|
return QuestionMutation(question=question)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user