From 89c7454dbdae3e0df6d96aa6132205d05e4a9b3d Mon Sep 17 00:00:00 2001 From: Thomas Chaumeny Date: Fri, 7 Jul 2023 13:08:17 +0200 Subject: Fixed #34698 -- Made QuerySet.bulk_create() retrieve primary keys when updating conflicts. --- docs/ref/models/querysets.txt | 10 +++++++--- docs/releases/5.0.txt | 4 ++++ 2 files changed, 11 insertions(+), 3 deletions(-) (limited to 'docs') diff --git a/docs/ref/models/querysets.txt b/docs/ref/models/querysets.txt index a754953264..fd6bb39ff8 100644 --- a/docs/ref/models/querysets.txt +++ b/docs/ref/models/querysets.txt @@ -2411,9 +2411,13 @@ On databases that support it (all except Oracle and SQLite < 3.24), setting the SQLite, in addition to ``update_fields``, a list of ``unique_fields`` that may be in conflict must be provided. -Enabling the ``ignore_conflicts`` or ``update_conflicts`` parameter disable -setting the primary key on each model instance (if the database normally -support it). +Enabling the ``ignore_conflicts`` parameter disables setting the primary key on +each model instance (if the database normally supports it). + +.. versionchanged:: 5.0 + + In older versions, enabling the ``update_conflicts`` parameter prevented + setting the primary key on each model instance. .. warning:: diff --git a/docs/releases/5.0.txt b/docs/releases/5.0.txt index 0ad0835c29..e4c1eac1d9 100644 --- a/docs/releases/5.0.txt +++ b/docs/releases/5.0.txt @@ -357,6 +357,10 @@ Models :meth:`.Model.save` now allows specifying a tuple of parent classes that must be forced to be inserted. +* :meth:`.QuerySet.bulk_create` and :meth:`.QuerySet.abulk_create` methods now + set the primary key on each model instance when the ``update_conflicts`` + parameter is enabled (if the database supports it). + Pagination ~~~~~~~~~~ -- cgit v1.3