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

Restoring soft-deleted child objects of an object being restored #68

Open
helgihg opened this issue May 30, 2017 · 0 comments
Open

Restoring soft-deleted child objects of an object being restored #68

helgihg opened this issue May 30, 2017 · 0 comments

Comments

@helgihg
Copy link

helgihg commented May 30, 2017

Thanks for a cool library.

I've been messing around with the code to try and make it restore child objects of an object being restored. The childrens' parent class is of course PermanentModel as well, but their respective foreign key is cleared upon soft deletion at the time when their parent object is soft-deleted.

Tracing my way through the code, it appeared that this separation of foreign keys was taking place at deletion.py:98 (setattr(obj, field.attname, value)). I tried setting up an optional parameter to the .delete() function, preserve_foreign_keys=False (by default), but even when making absolutely sure that the aforementioned line is not running, the behavior is not changed. The foreign key of the soft-deleted child objects to the parent object still gets removed somewhere else.

At this point I figured I might as well just ask here if this is a feature to be expected. Or if this possibly just a really bad idea. I think it would be lovely!

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