Skip to content

Adding DjangoModelFormMutation to schema raises import error #602

@GitRon

Description

@GitRon

Hi there!

I try to use the awesome DjangoModelFormMutation but when I add the mutation to the schema I always get this error:

Could not import 'project.config.schema.schema' for Graphene setting 'SCHEMA'. AttributeError: 'NoneType' object has no attribute '_meta'.

Here's my setup:

class Pet(models.Model):
    name = models.CharField()

class PetForm(forms.ModelForm):
    class Meta:
        model = Pet
        fields = ('name',)

class PetMutation(DjangoModelFormMutation):
    class Meta:
        form_class = PetForm

class PetMutations(graphene.ObjectType):
    pet = PetMutation.Field(description="Pets!")


class Mutation(PetMutations,
               graphene.ObjectType):
    pass

schema = graphene.Schema(query=Query, mutation=Mutation)

Any ideas what I might be doing wrong?

Thanks!
Ron

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions