Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No good way to undelete objects that don't know that they are deleted yet #74

Open
ralokt opened this issue Jan 19, 2021 · 1 comment
Open

Comments

@ralokt
Copy link

ralokt commented Jan 19, 2021

Let's say I have two model objects foo and bar, and let's say that soft deleting foo has the side effect of also soft deleting bar.

For unit testing, I'd like to be able to do something like

foo.delete()
(...)
foo.undelete()
bar.undelete()

This will fail with an AssertionError because bar is desynchronized from the db. However, we also can't use bar.refresh_from_db() because the default manager doesn't find it anymore (see also: #73 ).

@ralokt
Copy link
Author

ralokt commented Jan 19, 2021

(A side note: as a workaround, the following works for me:

foo.delete()
bar.deleted = True
(...)
foo.undelete()
bar.undelete()

But also, that is very hacky.
)

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

No branches or pull requests

1 participant