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
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.
The text was updated successfully, but these errors were encountered:
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.The text was updated successfully, but these errors were encountered: