Let's say I have the following Listing
model. I retrieve a listing and store that in old_listing
, and set up a new one and store that in new_listing
. Now is there some way to save new_listing
into old_listing
, basically overriding all fields except the auto-incrementing id
field?
class Listing(models.Model):
street = models.CharField(max_length=500)
old_listing = Listing.objects.get(id=1) # Assuming this record already exists
new_listing = Listing(street='123 Main Street')
old_listing.save(new_listing) # This obviously doesn't work