I try to update the PK in Django with the .save()
method, but when I save the object, Django duplicates the object with the same data but a different PK. For example:
from gestion_empleados.Models import Empleados
>>> e = Empleados.objects.get(pk="56789034U")
>>> e.pk
u'56789034U'
>>> e.pk = "11111111L"
>>> e.save()
>>> e.pk
'11111111L'
>>> e2 = Empleados.objects.get(pk="56789034U")
>>> e2
<Empleados: Juan 56789034U>
>>> e
<Empleados: Juan 11111111L>
The objects are the same with different PKs, and I want to change the PK without duplicating the object.
Any solution? Thanks!