diff options
| author | Anssi Kääriäinen <anssi.kaariainen@thl.fi> | 2015-01-28 13:40:48 +0200 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2015-02-03 09:25:55 -0500 |
| commit | 43b0131fb5724cb92716eedfe35a6b2b4d84e1e5 (patch) | |
| tree | b43548de46f19fd075f6eadcad78facabef4f255 /docs/ref | |
| parent | 9ffe013caa9360183cdb948b8e03c9c2a0da5417 (diff) | |
[1.8.x] 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.
Backport of 8adc59038cdc6ce4f9170e4de2d716d940e136b3 from master
Diffstat (limited to 'docs/ref')
| -rw-r--r-- | docs/ref/models/fields.txt | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/docs/ref/models/fields.txt b/docs/ref/models/fields.txt index 8604137afe..f4fe52a737 100644 --- a/docs/ref/models/fields.txt +++ b/docs/ref/models/fields.txt @@ -220,6 +220,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`` ------------ |
