Skip to content

Commit bad8e13

Browse files
authored
Merge pull request #657 from sweenr/patch-1
Update mutations.rst
2 parents 0916e03 + d06217d commit bad8e13

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

docs/mutations.rst

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,9 @@ You can use relay with mutations. A Relay mutation must inherit from
199199

200200
.. code:: python
201201
202-
import graphene import relay, DjangoObjectType
202+
import graphene
203+
from graphene import relay
204+
from graphene_django import DjangoObjectType
203205
from graphql_relay import from_global_id
204206
205207
from .queries import QuestionType
@@ -214,7 +216,7 @@ You can use relay with mutations. A Relay mutation must inherit from
214216
215217
@classmethod
216218
def mutate_and_get_payload(cls, root, info, text, id):
217-
question = Question.objects.get(pk=from_global_id(id))
219+
question = Question.objects.get(pk=from_global_id(id)[1])
218220
question.text = text
219221
question.save()
220222
return QuestionMutation(question=question)
@@ -226,4 +228,4 @@ Relay ClientIDMutation accept a ``clientIDMutation`` argument.
226228
This argument is also sent back to the client with the mutation result
227229
(you do not have to do anything). For services that manage
228230
a pool of many GraphQL requests in bulk, the ``clientIDMutation``
229-
allows you to match up a specific mutation with the response.
231+
allows you to match up a specific mutation with the response.

0 commit comments

Comments
 (0)