mirror of
https://github.com/graphql-python/graphene-django.git
synced 2024-11-29 13:03:44 +03:00
commit
bad8e13282
|
@ -199,7 +199,9 @@ You can use relay with mutations. A Relay mutation must inherit from
|
||||||
|
|
||||||
.. code:: python
|
.. 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 graphql_relay import from_global_id
|
||||||
|
|
||||||
from .queries import QuestionType
|
from .queries import QuestionType
|
||||||
|
@ -214,7 +216,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