django-safedelete
django-safedelete copied to clipboard
Proposal to solve #118
Undeletes only the related models that were deleted in the same time. This assumes that the model and all related were deleted in a cascade operation that lasted less than 60 seconds. (Maybe this should be in a configuration in settings.py?)
Signed-off-by: Vinicius Cubas Brand [email protected]
I don't like adding this as it is, there will be race conditons with this.
Imho we should: add a setting/parameter to block this behaviour (undeleting related objects) and document this issue.
@Gagaro could you give some more insight in what race conditions might occur?
What would you propose as a parameter/setting then? I'm not sure what your plan is.
Let's say we have an object Foobar
with two relations: Foo
and Bar
.
User A delete Foo
.
Then, User B delete FooBar
by mistake. It deleted Bar
at the same times. He decides to undelete it and it undeletes Bar
but also Foo
, which should stay deleted. This behaviour is not predictable.
You're right, I didn't think about multiple users. Perhaps we could provide some kind of functionality or leave it for others to propose on how to make this library more extendible in different ways?
So for now perhaps out of scope.