擅长:python、mysql、java
<p>我认为Django不允许您更改对象的主键。您可能必须删除原始对象。</p>
<pre><code>e2.delete()
</code></pre>
<p>根据Django docs</p>
<blockquote>
<p>The primary key field is read-only. If you change the value of the primary key on an existing object and then save it, a new object will be created alongside the old one.</p>
</blockquote>
<p><a href="https://docs.djangoproject.com/en/1.8/ref/models/fields/#primary-key" rel="noreferrer">Django Docs</a></p>