mirror of
https://github.com/graphql-python/graphene-django.git
synced 2025-06-05 06:03:06 +03:00
* handle deprecation warning for requires_system_checks Removed in django 4.1. * Fix broken UT due to pytest import error (#1368) * import error resolved? * Fix tests * Remove Python 3.6 * django 4.1 requires python>=3.10 * Django 4.1 does support python 3.8 to 3.11 * Add Django 4.1 to tox --------- Co-authored-by: Yuekui <yuekui@users.noreply.github.com> Co-authored-by: Josh Warwick <josh.warwick15@gmail.com> Co-authored-by: Kien Dang <mail@kien.ai>
45 lines
1.1 KiB
Python
45 lines
1.1 KiB
Python
# https://github.com/graphql-python/graphene-django/issues/520
|
|
|
|
import datetime
|
|
|
|
from django import forms
|
|
|
|
import graphene
|
|
|
|
from graphene import Field, ResolveInfo
|
|
from graphene.types.inputobjecttype import InputObjectType
|
|
from pytest import raises
|
|
from pytest import mark
|
|
from rest_framework import serializers
|
|
|
|
from ...types import DjangoObjectType
|
|
from ...rest_framework.models import MyFakeModel
|
|
from ...rest_framework.mutation import SerializerMutation
|
|
from ...forms.mutation import DjangoFormMutation
|
|
|
|
|
|
class MyModelSerializer(serializers.ModelSerializer):
|
|
class Meta:
|
|
model = MyFakeModel
|
|
fields = "__all__"
|
|
|
|
|
|
class MyForm(forms.Form):
|
|
text = forms.CharField()
|
|
|
|
|
|
def test_can_use_form_and_serializer_mutations():
|
|
class MyMutation(SerializerMutation):
|
|
class Meta:
|
|
serializer_class = MyModelSerializer
|
|
|
|
class MyFormMutation(DjangoFormMutation):
|
|
class Meta:
|
|
form_class = MyForm
|
|
|
|
class Mutation(graphene.ObjectType):
|
|
my_mutation = MyMutation.Field()
|
|
my_form_mutation = MyFormMutation.Field()
|
|
|
|
graphene.Schema(mutation=Mutation)
|