File tree Expand file tree Collapse file tree 2 files changed +44
-0
lines changed
graphene_django/tests/issues Expand file tree Collapse file tree 2 files changed +44
-0
lines changed Original file line number Diff line number Diff line change
1
+ # https://github.com/graphql-python/graphene-django/issues/520
2
+
3
+ import datetime
4
+
5
+ from django import forms
6
+
7
+ import graphene
8
+
9
+ from graphene import Field , ResolveInfo
10
+ from graphene .types .inputobjecttype import InputObjectType
11
+ from py .test import raises
12
+ from py .test import mark
13
+ from rest_framework import serializers
14
+
15
+ from ...types import DjangoObjectType
16
+ from ...rest_framework .models import MyFakeModel
17
+ from ...rest_framework .mutation import SerializerMutation
18
+ from ...forms .mutation import DjangoFormMutation
19
+
20
+
21
+ class MyModelSerializer (serializers .ModelSerializer ):
22
+ class Meta :
23
+ model = MyFakeModel
24
+ fields = "__all__"
25
+
26
+
27
+ class MyForm (forms .Form ):
28
+ text = forms .CharField ()
29
+
30
+
31
+ def test_can_use_form_and_serializer_mutations ():
32
+ class MyMutation (SerializerMutation ):
33
+ class Meta :
34
+ serializer_class = MyModelSerializer
35
+
36
+ class MyFormMutation (DjangoFormMutation ):
37
+ class Meta :
38
+ form_class = MyForm
39
+
40
+ class Mutation (graphene .ObjectType ):
41
+ my_mutation = MyMutation .Field ()
42
+ my_form_mutation = MyFormMutation .Field ()
43
+
44
+ graphene .Schema (mutation = Mutation )
You can’t perform that action at this time.
0 commit comments