-
-
Notifications
You must be signed in to change notification settings - Fork 24
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
[Feature] Pass origin object to signals #876
Comments
Thanks for reporting this issue, don't forget to star this project if you haven't already to help us reach a wider audience. |
I found that I also need My approach (see mixin.py in the
The project that's using this fork of @receiver(pre_clone_save)
def set_new_clone_state_true(sender, instance, **kwargs):
instance._state.new_clone = True
instance._state.origin = kwargs.get("origin")
instance._state.calling_function = kwargs.get("calling_function", None)
instance._state.parent_instance = kwargs.get("parent_instance", None)
instance._state.cascade_clone = (
instance._state.parent_instance is not None and instance._state.calling_function is not None
) These can then be picked up in the relevant Another possible benefit of having I don't know if any of this is generally needed by anyone else, but it seemed pretty close to @dacotagh 's requirement here. I thought maybe using **kwargs would meet the immediate objective and also provide room for future needs. PS Thanks @jackton1 very much for this terrific library! |
Is this feature missing in the latest version?
Is your feature request related to a problem? Please describe.
Some copied objects have links to data out of the data base, linked by id or uuid.
When object cloned, it has new id/uuid.
To copy external data user need access to origin id/uuid of object.
Describe the solution you'd like?
I suppose to add origin parameter to pre_clone_save/post_clone_save signals.
To do this, in function make_clone in mixin.py we need to make these changes:
...
Describe alternatives you've considered?
No response
Anything else?
No response
Code of Conduct
The text was updated successfully, but these errors were encountered: