I have a Django model object that has a few normal attributes, and it has a ImageField for the logo. I want to write a method that'll copy this object to a new object. It's easy enough to instanciate the new object, then loop over all the attributes and copy from the old to new (e.g. new_object.name = old_object.name
). However if I do that with the logo field (i.e. new_object.logo = old_object.logo
), both new_object and old_object point to the same file on the harddisk. If you edit the old file, the logo for the new object will change.
What's the best way to have a full/deep copy of the ImageField? I want it to have a different file name and to point to a different file on the disk, but it should have exactly the same content.