Skip to content

[Feature] Pass origin object to signals #876

@dacotagh

Description

@dacotagh

Is this feature missing in the latest version?

  • I'm using the latest release

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:

    -pre_clone_save.send(sender=self.__class__, instance=duplicate)
    +pre_clone_save.send(sender=self.__class__, instance=duplicate, origin=self)

...

    -post_clone_save.send(sender=self.__class__, instance=duplicate)
    +post_clone_save.send(sender=self.__class__, instance=duplicate, origin=self)

Describe alternatives you've considered?

No response

Anything else?

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions