Skip to content

Conversation

Etenil
Copy link
Contributor

@Etenil Etenil commented May 18, 2020

The pre-save hook makes the assumption that a PK that is set denotes a model update. In transactions it can happen that a PK is defined however the model isn't actually saved yet. The current code causes an error in these conditions.

jsoa added a commit to jsoa/django-easy-audit that referenced this pull request May 18, 2020
@jsoa jsoa mentioned this pull request May 18, 2020
8 tasks
@jheld
Copy link
Collaborator

jheld commented May 19, 2020

Interesting fix. Looks good.

Can you also add a test case?

@Etenil
Copy link
Contributor Author

Etenil commented May 27, 2020

@jheld added test

jheld pushed a commit that referenced this pull request Jul 22, 2020
* [-] CrudEvent object_id as a `CharField`

* [-] Use `pk` instead of `id` in pre_save object lookup

* [-] Fixes issue w/ post_delete / Adds delete test

* [-] Adds updates from #141 PR

* [-] Removes the need for an explicit query

- Uses the internal `_state` object

* [-] Adds `_state` compat test

* [-] Removes sqlite3 test db
@jheld
Copy link
Collaborator

jheld commented Aug 7, 2020

@Etenil can you check if the pre_save logic is still in need of change based on current master?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants