Skip to content

Commit

Permalink
Merge pull request #657 from sweenr/patch-1
Browse files Browse the repository at this point in the history
Update mutations.rst
  • Loading branch information
phalt authored Jun 7, 2019
2 parents 0916e03 + d06217d commit bad8e13
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions docs/mutations.rst
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,9 @@ You can use relay with mutations. A Relay mutation must inherit from

.. code:: python
import graphene import relay, DjangoObjectType
import graphene
from graphene import relay
from graphene_django import DjangoObjectType
from graphql_relay import from_global_id
from .queries import QuestionType
Expand All @@ -214,7 +216,7 @@ You can use relay with mutations. A Relay mutation must inherit from
@classmethod
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.save()
return QuestionMutation(question=question)
Expand All @@ -226,4 +228,4 @@ Relay ClientIDMutation accept a ``clientIDMutation`` argument.
This argument is also sent back to the client with the mutation result
(you do not have to do anything). For services that manage
a pool of many GraphQL requests in bulk, the ``clientIDMutation``
allows you to match up a specific mutation with the response.
allows you to match up a specific mutation with the response.

0 comments on commit bad8e13

Please sign in to comment.