summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorAnssi Kääriäinen <anssi.kaariainen@thl.fi>2015-01-28 13:40:48 +0200
committerTim Graham <timograham@gmail.com>2015-02-03 09:23:44 -0500
commit8adc59038cdc6ce4f9170e4de2d716d940e136b3 (patch)
treee9a868fd51f6c4d5d9be17391573053ab544c721 /docs
parent118b11221f7f632b4d0e6e976c87f563746ec211 (diff)
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.
Diffstat (limited to 'docs')
-rw-r--r--docs/ref/models/fields.txt9
-rw-r--r--docs/releases/1.8.txt3
2 files changed, 12 insertions, 0 deletions
diff --git a/docs/ref/models/fields.txt b/docs/ref/models/fields.txt
index 01fcb1a4ed..4eb16d4345 100644
--- a/docs/ref/models/fields.txt
+++ b/docs/ref/models/fields.txt
@@ -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``
------------
diff --git a/docs/releases/1.8.txt b/docs/releases/1.8.txt
index bee112b713..bbb932ada3 100644
--- a/docs/releases/1.8.txt
+++ b/docs/releases/1.8.txt
@@ -526,6 +526,9 @@ Models
* You can now get the set of deferred fields for a model using
:meth:`Model.get_deferred_fields() <django.db.models.Model.get_deferred_fields>`.
+* Model field ``default``’s are now used when primary key field's are set to
+ ``None``.
+
Signals
^^^^^^^