mirror of
https://github.com/django/django.git
synced 2025-08-04 19:08:28 +00:00
Fixed #23617 -- Added get_pk_value_on_save()
The method is mainly intended for use with UUIDField. For UUIDField we want to call the field's default even when primary key value is explicitly set to None to match the behavior of AutoField. Thanks to Marc Tamlyn and Tim Graham for review.
This commit is contained in:
parent
118b11221f
commit
8adc59038c
6 changed files with 50 additions and 0 deletions
|
@ -217,6 +217,15 @@ Note that ``lambda``\s cannot be used for field options like ``default``
|
|||
because they cannot be :ref:`serialized by migrations <migration-serializing>`.
|
||||
See that documentation for other caveats.
|
||||
|
||||
The default value is used when new model instances are created and a value
|
||||
isn't provided for the field. When the field is a primary key, the default is
|
||||
also used when the field is set to ``None``.
|
||||
|
||||
.. versionchanged:: 1.8
|
||||
|
||||
The default wasn't used for ``None`` primary key values in previous
|
||||
versions.
|
||||
|
||||
``editable``
|
||||
------------
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue