Skip to content

Type <class 'fieldrecords.schema.Mutation'> is not a valid ObjectType. #747

@a-c-sreedhar-reddy

Description

@a-c-sreedhar-reddy

This is my piece of code.


class FieldMutation(graphene.Mutation):
    class Arguments:
        id = graphene.String(required=True)
        name = graphene.String()
        acres = graphene.Int()
    field = graphene.Field(FieldType)

    def mutate(self, info, **kwargs):
        field = Field.objects.get(pk=kwargs.get("id"))
        field.name = kwargs.get("name", field.name)
        field.acres = kwargs.get("acres", field.acres)
        field.save()
        return FieldMutation(field=field)


class Mutation:
    update_field = FieldMutation.Field()


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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions