diff options
| author | Jon Janzen <jon@jonjanzen.com> | 2022-11-03 19:57:33 +0100 |
|---|---|---|
| committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2022-11-09 10:32:40 +0100 |
| commit | 321ecb40f4da842926e1bc07e11df4aabe53ca4b (patch) | |
| tree | 3a306ec0bc38c90eb95d8adceaecc3017e1b3d06 /docs/ref | |
| parent | 41e8931c2cc68d8b2de4219be930e2c305b4eba1 (diff) | |
Fixed #34135 -- Added async-compatible interface to related managers.
Diffstat (limited to 'docs/ref')
| -rw-r--r-- | docs/ref/models/relations.txt | 42 |
1 files changed, 36 insertions, 6 deletions
diff --git a/docs/ref/models/relations.txt b/docs/ref/models/relations.txt index c091612c6e..1b1aad7425 100644 --- a/docs/ref/models/relations.txt +++ b/docs/ref/models/relations.txt @@ -37,6 +37,9 @@ Related objects reference ``topping.pizza_set`` and on ``pizza.toppings``. .. method:: add(*objs, bulk=True, through_defaults=None) + .. method:: aadd(*objs, bulk=True, through_defaults=None) + + *Asynchronous version*: ``aadd`` Adds the specified model objects to the related object set. @@ -75,6 +78,10 @@ Related objects reference dictionary and they will be evaluated once before creating any intermediate instance(s). + .. versionchanged:: 4.2 + + ``aadd()`` method was added. + .. method:: create(through_defaults=None, **kwargs) .. method:: acreate(through_defaults=None, **kwargs) @@ -118,6 +125,9 @@ Related objects reference ``acreate()`` method was added. .. method:: remove(*objs, bulk=True) + .. method:: aremove(*objs, bulk=True) + + *Asynchronous version*: ``aremove`` Removes the specified model objects from the related object set:: @@ -157,7 +167,14 @@ Related objects reference For many-to-many relationships, the ``bulk`` keyword argument doesn't exist. + .. versionchanged:: 4.2 + + ``aremove()`` method was added. + .. method:: clear(bulk=True) + .. method:: aclear(bulk=True) + + *Asynchronous version*: ``aclear`` Removes all objects from the related object set:: @@ -174,7 +191,14 @@ Related objects reference For many-to-many relationships, the ``bulk`` keyword argument doesn't exist. + .. versionchanged:: 4.2 + + ``aclear()`` method was added. + .. method:: set(objs, bulk=True, clear=False, through_defaults=None) + .. method:: aset(objs, bulk=True, clear=False, through_defaults=None) + + *Asynchronous version*: ``aset`` Replace the set of related objects:: @@ -207,13 +231,19 @@ Related objects reference dictionary and they will be evaluated once before creating any intermediate instance(s). + .. versionchanged:: 4.2 + + ``aset()`` method was added. + .. note:: - Note that ``add()``, ``create()``, ``remove()``, ``clear()``, and - ``set()`` all apply database changes immediately for all types of - related fields. In other words, there is no need to call ``save()`` - on either end of the relationship. + Note that ``add()``, ``aadd()``, ``create()``, ``acreate()``, + ``remove()``, ``aremove()``, ``clear()``, ``aclear()``, ``set()``, and + ``aset()`` all apply database changes immediately for all types of + related fields. In other words, there is no need to call + ``save()``/``asave()`` on either end of the relationship. If you use :meth:`~django.db.models.query.QuerySet.prefetch_related`, - the ``add()``, ``remove()``, ``clear()``, and ``set()`` methods clear - the prefetched cache. + the ``add()``, ``aadd()``, ``remove()``, ``aremove()``, ``clear()``, + ``aclear()``, ``set()``, and ``aset()`` methods clear the prefetched + cache. |
