1
0
mirror of https://github.com/django/django.git synced 2025-10-31 09:41:08 +00:00

[4.1.x] Fixed #34139 -- Fixed acreate(), aget_or_create(), and aupdate_or_create() methods for related managers.

Bug in 58b27e0dbb.

Backport of 7b94847e38 from main
This commit is contained in:
Jon Janzen
2022-11-04 15:22:32 +01:00
committed by Mariusz Felisiak
parent 8740d2f452
commit 9fb57fcc70
8 changed files with 155 additions and 0 deletions

View File

@@ -76,6 +76,9 @@ Related objects reference
intermediate instance(s).
.. method:: create(through_defaults=None, **kwargs)
.. method:: acreate(through_defaults=None, **kwargs)
*Asynchronous version*: ``acreate``
Creates a new object, saves it and puts it in the related object set.
Returns the newly created object::
@@ -110,6 +113,10 @@ Related objects reference
needed. You can use callables as values in the ``through_defaults``
dictionary.
.. versionchanged:: 4.1
``acreate()`` method was added.
.. method:: remove(*objs, bulk=True)
Removes the specified model objects from the related object set::

View File

@@ -16,3 +16,7 @@ Bugfixes
an empty :meth:`Sitemap.items() <django.contrib.sitemaps.Sitemap.items>` and
a callable :attr:`~django.contrib.sitemaps.Sitemap.lastmod`
(:ticket:`34088`).
* Fixed a bug in Django 4.1 that caused a crash of ``acreate()``,
``aget_or_create()``, and ``aupdate_or_create()`` asynchronous methods for
related managers (:ticket:`34139`).