xxxxxxxxxx
# Django
original_instance = mymodel.objects.get(id=pk)
print(original_instance.myfeild)
new_instance = models.mymodel()
for field in original_instance._meta.get_fields():
if field.auto_created or field.primary_key:
continue
if hasattr(original_instance, field.name):
setattr(new_instance, field.name, getattr(original_instance, field.name))
new_instance.save()
xxxxxxxxxx
#Change the primary key of your object and run save().
obj = Foo.objects.get(pk=<some_existing_pk>)
obj.pk = None
obj.save()