Skip to content

Commit fc49a50

Browse files
authored
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
1 parent 0916e03 commit fc49a50

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

docs/mutations.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ You can use relay with mutations. A Relay mutation must inherit from
214214
215215
@classmethod
216216
def mutate_and_get_payload(cls, root, info, text, id):
217-
question = Question.objects.get(pk=from_global_id(id))
217+
question = Question.objects.get(pk=from_global_id(id)[1])
218218
question.text = text
219219
question.save()
220220
return QuestionMutation(question=question)
@@ -226,4 +226,4 @@ Relay ClientIDMutation accept a ``clientIDMutation`` argument.
226226
This argument is also sent back to the client with the mutation result
227227
(you do not have to do anything). For services that manage
228228
a pool of many GraphQL requests in bulk, the ``clientIDMutation``
229-
allows you to match up a specific mutation with the response.
229+
allows you to match up a specific mutation with the response.

0 commit comments

Comments
 (0)