You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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!
The text was updated successfully, but these errors were encountered:
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!
The text was updated successfully, but these errors were encountered: