1
0
mirror of https://github.com/django/django.git synced 2024-12-23 01:25:58 +00:00

Fixed #34099 -- Added release notes for QuerySet.update_or_create() changes.

Follow up to 6cc0f22a73.

Thanks Phil Gyford for the report.
This commit is contained in:
sarahboyce 2022-11-11 09:43:50 +01:00 committed by Mariusz Felisiak
parent 0678d65722
commit 7a5307974a
2 changed files with 15 additions and 0 deletions

View File

@ -2271,6 +2271,11 @@ exists in the database, an :exc:`~django.db.IntegrityError` is raised.
``aupdate_or_create()`` method was added.
.. versionchanged:: 4.2
In older versions, ``update_or_create()`` didn't specify ``update_fields``
when calling :meth:`Model.save() <django.db.models.Model.save>`.
``bulk_create()``
~~~~~~~~~~~~~~~~~

View File

@ -355,6 +355,16 @@ Dropped support for PostgreSQL 11
Upstream support for PostgreSQL 11 ends in November 2023. Django 4.2 supports
PostgreSQL 12 and higher.
Setting ``update_fields`` in ``Model.save()`` may now be required
-----------------------------------------------------------------
In order to avoid updating unnecessary columns,
:meth:`.QuerySet.update_or_create` now passes ``update_fields`` to the
:meth:`Model.save() <django.db.models.Model.save>` calls. As a consequence, any
fields modified in the custom ``save()`` methods should be added to the
``update_fields`` keyword argument before calling ``super()``. See
:ref:`overriding-model-methods` for more details.
Miscellaneous
-------------