1
0
mirror of https://github.com/django/django.git synced 2025-10-28 16:16:12 +00:00

Fixed #36068 -- Raised ValueError when providing a composite PK field to bulk_create() update_fields.

This commit is contained in:
Jacob Walls
2025-01-07 06:28:57 -05:00
committed by Sarah Boyce
parent af6336f2c8
commit 0fb51ec5a0
2 changed files with 17 additions and 2 deletions

View File

@@ -728,7 +728,7 @@ class QuerySet(AltersData):
"bulk_create() can only be used with concrete fields in "
"update_fields."
)
if any(f.primary_key for f in update_fields):
if any(f in self.model._meta.pk_fields for f in update_fields):
raise ValueError(
"bulk_create() cannot be used with primary keys in "
"update_fields."