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

Proposal: Add a helper function to create a copy of a model instance #1839

Open
hrushikeshrv opened this issue Sep 19, 2023 · 0 comments
Open

Comments

@hrushikeshrv
Copy link

Currently the documented way to create a copy of a model instance is by setting its pk to None and saving the instance again - see link. It also states that there is no built-in method for copying model instances.

Adding such a function was discussed in this ticket closed 12 years ago, but was not implemented. Instead, it was decided to just document the process. IMO, having a single function which would handle the copying of a model instance in all types of scenarios (deep/shallow copy, keep M2M or FK relationships, etc.) would be helpful, and django-extensions would be a good place to have such a utility function.

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