1
0
mirror of https://github.com/django/django.git synced 2025-10-31 09:41:08 +00:00

[1.6.x] Fixed #24041 -- Documented effect of changing a model instance's primary key.

Backport of 4ccdf6e57f from master
This commit is contained in:
Helen Sherwood-Taylor
2014-12-24 19:15:48 +00:00
committed by Tim Graham
parent 70c965ad4f
commit 2d0ae995d6
2 changed files with 24 additions and 2 deletions

View File

@@ -258,8 +258,13 @@ don't need to set ``primary_key=True`` on any of your fields unless you want to
override the default primary-key behavior. For more, see
:ref:`automatic-primary-key-fields`.
``primary_key=True`` implies :attr:`null=False <Field.null>` and :attr:`unique=True <Field.unique>`.
Only one primary key is allowed on an object.
``primary_key=True`` implies :attr:`null=False <Field.null>` and
:attr:`unique=True <Field.unique>`. Only one primary key is allowed on an
object.
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.
``unique``
----------