diff options
| author | Baptiste Mispelon <bmispelon@gmail.com> | 2019-11-29 17:54:03 +0100 |
|---|---|---|
| committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2019-12-03 19:47:38 +0100 |
| commit | 26cab4e8c113b873b99b747128a064ba72d40c74 (patch) | |
| tree | 6188b4fc81f4cddde3f68562a50342ef367f632c /docs | |
| parent | c50839fccf8b3235624b70b2c263157e570dbc2a (diff) | |
Fixed #31046 -- Allowed RelatedManager.add()/create()/set() to accept callable values in through_defaults.
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/ref/models/relations.txt | 23 | ||||
| -rw-r--r-- | docs/releases/3.1.txt | 4 |
2 files changed, 24 insertions, 3 deletions
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 <intermediary-manytomany>` 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 <intermediary-manytomany>` 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 <intermediary-manytomany>` 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:: diff --git a/docs/releases/3.1.txt b/docs/releases/3.1.txt index dc16b95f79..b4179883ab 100644 --- a/docs/releases/3.1.txt +++ b/docs/releases/3.1.txt @@ -209,6 +209,10 @@ Models * :attr:`.CheckConstraint.check` now supports boolean expressions. +* The :meth:`.RelatedManager.add`, :meth:`~.RelatedManager.create`, and + :meth:`~.RelatedManager.set` methods now accept callables as values in the + ``through_defaults`` argument. + Pagination ~~~~~~~~~~ |
