From 26cab4e8c113b873b99b747128a064ba72d40c74 Mon Sep 17 00:00:00 2001 From: Baptiste Mispelon Date: Fri, 29 Nov 2019 17:54:03 +0100 Subject: Fixed #31046 -- Allowed RelatedManager.add()/create()/set() to accept callable values in through_defaults. --- docs/ref/models/relations.txt | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) (limited to 'docs/ref/models') diff --git a/docs/ref/models/relations.txt b/docs/ref/models/relations.txt index d50e3891dc..2560a8e81c 100644 --- a/docs/ref/models/relations.txt +++ b/docs/ref/models/relations.txt @@ -71,7 +71,13 @@ Related objects reference Use the ``through_defaults`` argument to specify values for the new :ref:`intermediate model ` instance(s), if - needed. + needed. You can use callables as values in the ``through_defaults`` + dictionary and they will be evaluated once before creating any + intermediate instance(s). + + .. versionchanged:: 3.1 + + ``through_defaults`` values can now be callables. .. method:: create(through_defaults=None, **kwargs) @@ -105,7 +111,12 @@ Related objects reference Use the ``through_defaults`` argument to specify values for the new :ref:`intermediate model ` instance, if - needed. + needed. You can use callables as values in the ``through_defaults`` + dictionary. + + .. versionchanged:: 3.1 + + ``through_defaults`` values can now be callables. .. method:: remove(*objs, bulk=True) @@ -193,7 +204,13 @@ Related objects reference Use the ``through_defaults`` argument to specify values for the new :ref:`intermediate model ` instance(s), if - needed. + needed. You can use callables as values in the ``through_defaults`` + dictionary and they will be evaluated once before creating any + intermediate instance(s). + + .. versionchanged:: 3.1 + + ``through_defaults`` values can now be callables. .. note:: -- cgit v1.3