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'm not sure if I'm understanding this correctly or if I've discovered some sort of a bug. I'm trying to use restore_on_create to seamlessly restore an object when it has been soft-deleted but is then added again.
The only thing I can find in the documentation is this: "If you need to restore a deleted object instead of re-creating the same one use the restore_on_create attribute:"
My understanding is that if the object which is being created has the same field values as one that already exists in the database but has been soft-deleted, then the soft-deleted object will be restored instead of a new record being created. At the bottom of this post is the relevant data in CSV form. The uppermost comment shows the field names.
It appears to me that the object is indeed identical aside from the removed-field (and the ID, of course). Should I be doing something more than inheriting the model from PermanentModel and including the "class Permanent: restore_on_create = True" thing?
So first things first; should this work the way I'm doing it? If so, then I can do some further experiments, although of course it would be helpful if developers have specific questions for me to check out. If I'm doing it wrong, and someone explains to me how it should be done, I can update the documentation.
The text was updated successfully, but these errors were encountered:
I'm not sure if I'm understanding this correctly or if I've discovered some sort of a bug. I'm trying to use restore_on_create to seamlessly restore an object when it has been soft-deleted but is then added again.
The only thing I can find in the documentation is this: "If you need to restore a deleted object instead of re-creating the same one use the restore_on_create attribute:"
My understanding is that if the object which is being created has the same field values as one that already exists in the database but has been soft-deleted, then the soft-deleted object will be restored instead of a new record being created. At the bottom of this post is the relevant data in CSV form. The uppermost comment shows the field names.
It appears to me that the object is indeed identical aside from the removed-field (and the ID, of course). Should I be doing something more than inheriting the model from PermanentModel and including the "class Permanent: restore_on_create = True" thing?
So first things first; should this work the way I'm doing it? If so, then I can do some further experiments, although of course it would be helpful if developers have specific questions for me to check out. If I'm doing it wrong, and someone explains to me how it should be done, I can update the documentation.
The text was updated successfully, but these errors were encountered: