serializer_class is required for the SerializerMutation
class PriceSerializer(serializers.ModelSerializer):
class Meta:
model = Price
fields = '__all__'
class PriceMutation(SerializerMutation):
class Meta:
serializer_class = PriceSerializer
django==2.0.8 graphene_django==2.1.0 python 3.7
@hellpirat how did you resolve this issue? I am facing the same issue. When I follow the example https://docs.graphene-python.org/projects/django/en/latest/rest-framework/ here I get this error.
File "/root/Envs/venv/lib/python3.6/site-packages/graphene/utils/subclass_with_meta.py", line 52, in init_subclass super_class.init_subclass_with_meta(**options) File "/root/Envs/venv/lib/python3.6/site-packages/graphene_django/rest_framework/mutation.py", line 60, in init_subclass_with_meta raise Exception("serializer_class is required for the SerializerMutation")
@gvbkr There was a bad import. I did fix it and this is work.
import graphene
import path.to.schema
import path.to.mutations
class Query(
path.to.schema.Query,
graphene.ObjectType
):
pass
class Mutation(graphene.ObjectType):
mutation_field = path.to.mutations.MutationClass.Field()
schema = graphene.Schema(query=Query, mutation=Mutation)
+1 facing this issue...