Adrian Holovaty wrote: > On 1/12/06, Jacob Kaplan-Moss <[EMAIL PROTECTED]> wrote: > >>On Jan 12, 2006, at 8:09 AM, Simon Willison wrote: >> >>>Maybe it would be useful for all Django model objects to gain >>>themselves a duplicate() method which does exactly this - returns >>>an identical object but with id set to None. >> >>+1 -- obj.copy() might be a better syntax to mimic dict.copy(). > > > obj.copy() would be a nice addition, but would it also copy the values > of many-to-many relationships? Like, if a poll is on multiple sites, > would poll.copy() return an object with the sites set? > > Adrian > > -- > Adrian Holovaty > holovaty.com | djangoproject.com | chicagocrime.org >
Also, given that ForeignKeys atm always cause deletion of linked objects, this implies some form of ownership, which might lead people to think that this was going to duplicate 'owned' objects...