mirror of
https://github.com/graphql-python/graphene-django.git
synced 2025-07-13 17:52:19 +03:00
Update rest-framework.rst
This commit is contained in:
parent
13a2bc53d4
commit
b7ac8e17c9
|
@ -34,14 +34,12 @@ method as such:
|
||||||
from graphene_django.rest_framework.mutation import SerializerMutation
|
from graphene_django.rest_framework.mutation import SerializerMutation
|
||||||
|
|
||||||
class MySecondAwesomeMutation(SerializerMutation):
|
class MySecondAwesomeMutation(SerializerMutation):
|
||||||
|
|
||||||
@classmethod
|
|
||||||
def get_serializer(cls, instance, args, request, info):
|
|
||||||
|
|
||||||
input = args.get('input')
|
|
||||||
|
|
||||||
return cls._meta.serializer_class(data=dict(input),
|
|
||||||
context={'request': request})
|
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
serializer_class = MySerializer
|
serializer_class = MySerializer
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def get_serializer(cls, root, info, input):
|
||||||
|
request = info.context
|
||||||
|
return cls._meta.serializer_class(data=dict(input),
|
||||||
|
context={'request': request})
|
||||||
|
|
Loading…
Reference in New Issue
Block a user