Editing a primary key in DJango
<p>I registered a model on DJango admin app to be able to edit its entries.
"<code>admin.site.register(model)</code>"
However DJango treats PK as read-only so when trying to edit it, it duplicates the entry and ignores any reference to it by Foreign keys.</p>

<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. You can look at <a href="https://docs.djangoproject.com/es/1.9/topics/db/models/" rel="nofollow">this example </a> to know what I mean.</p>

<p>Is there anyway to be able to edit the primary key in a certain model and cascade the update to any reference to it by foreign keys?</p>

<p>This is models.py</p>

<pre><code>class Cabinet(models.Model):
    mac_address = models.CharField(max_length=17, primary_key=True)

class FailureLog(models.Model):
    mac_address = models.ForeignKey(Cabinet)
</code></pre>

<p>This is admin.py</p>

<pre><code>admin.site.register(Cabinet)
</code></pre>

<p>In the admin app, I can't change the primary key of Cabinet without duplicating it and loosing all reference to the FailureLog</p>