summaryrefslogtreecommitdiff
path: root/docs/ref/models
diff options
context:
space:
mode:
authorSimon Charette <simon.charette@zapier.com>2019-05-12 17:17:47 -0400
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2020-07-15 10:58:29 +0200
commit1e38f1191de21b6e96736f58df57dfb851a28c1f (patch)
tree99b2c92d87d4d351d1f180e93a543b8903ec28d3 /docs/ref/models
parentd08e6f55e3a986a8d4b3a58431d9615c7bc81eaa (diff)
Fixed #30446 -- Resolved Value.output_field for stdlib types.
This required implementing a limited form of dynamic dispatch to combine expressions with numerical output. Refs #26355 should eventually provide a better interface for that.
Diffstat (limited to 'docs/ref/models')
-rw-r--r--docs/ref/models/expressions.txt10
1 files changed, 9 insertions, 1 deletions
diff --git a/docs/ref/models/expressions.txt b/docs/ref/models/expressions.txt
index 252966bb6c..31d2572288 100644
--- a/docs/ref/models/expressions.txt
+++ b/docs/ref/models/expressions.txt
@@ -484,7 +484,15 @@ The ``output_field`` argument should be a model field instance, like
after it's retrieved from the database. Usually no arguments are needed when
instantiating the model field as any arguments relating to data validation
(``max_length``, ``max_digits``, etc.) will not be enforced on the expression's
-output value.
+output value. If no ``output_field`` is specified it will be tentatively
+inferred from the :py:class:`type` of the provided ``value``, if possible. For
+example, passing an instance of :py:class:`datetime.datetime` as ``value``
+would default ``output_field`` to :class:`~django.db.models.DateTimeField`.
+
+.. versionchanged:: 3.2
+
+ Support for inferring a default ``output_field`` from the type of ``value``
+ was added.
``ExpressionWrapper()`` expressions
-----------------------------------