Skip to content

before_save not being executed #83

Description

@HopeBaron
class CreateTableMutation(mutations.DjangoCreateMutation):
    class Meta:
        model = Table
        exclude_fields = ('owner',)
    create_column = CreateTableColumnMutation.Field()

    @classmethod
    def before_save(cls, root, info, input, obj: Table):
        obj.owner = User.objects.get(pk=1)
        return obj

I've the following code, before_save doesn't get executed (I copied the example in docs)

this is what I get:

{
  "errors": [
    {
      "message": "NOT NULL constraint failed: query_builder_table.owner_id",
      "locations": [
        {
          "line": 2,
          "column": 3
        }
      ],
      "path": [
        "createTable"
      ]
    }
  ],
  "data": {
    "createTable": null
  }
}

It's supposed to provide the owner object through the before_save, right?

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions