django-easy-audit icon indicating copy to clipboard operation
django-easy-audit copied to clipboard

master branch foreign key constraint on pre-save

Open jheld opened this issue 6 years ago • 3 comments

I'm still looking into this, but there is an issue when we try to create an object in our unit tests. It looks like it's failing in the pre-save due to a foreign key constraint.

I will be looking into it further tomorrow.

jheld avatar Mar 14 '18 23:03 jheld

OK. Doesn't seem pre-save related at this point.

But, the issue definitely occurs when all of the latest migrations are applied.

jheld avatar Mar 15 '18 15:03 jheld

Hi.

This happens when you have an object that has many to many relationships.

In this case, the serializers.serialize(...) call fails.

You can reproduce this by creating a Django instance of a model with many to many relationships and then trying to call serializers.serialize(...) BEFORE you save it.

Let me know if I can help with this.

KonstantinSchubert avatar Mar 28 '18 05:03 KonstantinSchubert

@KonstantinSchubert thank you for the write up. I'll look into it on my end too to verify, but in the meantime, if you have any recommendations for a solution or a PR to resolve, feel free to send it our way. I'll see if I/we can fix it, too.

jheld avatar Apr 13 '18 01:04 jheld