django-safedelete icon indicating copy to clipboard operation
django-safedelete copied to clipboard

Proposal to solve #118

Open viniciuscb opened this issue 5 years ago • 4 comments

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]

viniciuscb avatar Apr 15 '19 17:04 viniciuscb

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 avatar May 13 '19 09:05 Gagaro

@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.

AndreasBackx avatar May 14 '19 17:05 AndreasBackx

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.

Gagaro avatar May 17 '19 12:05 Gagaro

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.

AndreasBackx avatar May 17 '19 13:05 AndreasBackx