[Django]-How do I safely change the value of the primary key field in a Django model?

3👍

Don’t know if you’re still looking for this, but perhaps this snippet will help: http://djangosnippets.org/snippets/2915/.

This is not a very good database design though, because of exactly this sort of problem. It is generally better to use django’s implicit primary keys and and create my_primary_key as a unique field instead.

Leave a comment