summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
Diffstat (limited to 'docs')
-rw-r--r--docs/ref/models/fields.txt4
1 files changed, 4 insertions, 0 deletions
diff --git a/docs/ref/models/fields.txt b/docs/ref/models/fields.txt
index 6d3176512c..7243276305 100644
--- a/docs/ref/models/fields.txt
+++ b/docs/ref/models/fields.txt
@@ -220,6 +220,10 @@ 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.
+For fields like :class:`ForeignKey` that map to model instances, defaults
+should be the value of the field they reference (``pk`` unless
+:attr:`~ForeignKey.to_field` is set) instead of model instances.
+
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``.