Opened 6 years ago

Closed 6 years ago

#29974 closed Bug (fixed)

QuerySet.bulk_update() doesn't support non-truthy primary keys

Reported by: Tom Forbes Owned by: nobody
Component: Database layer (models, ORM) Version: dev
Severity: Normal Keywords:
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: yes UI/UX: no

Description

Currently bulk_update checks the bool() of each primary key given to the method. This will fail if the primary key is 0 (or another type that overrides __bool__ to return False). What I should have done is made the check explicitly check for None.

Change History (5)

comment:2 by Mariusz Felisiak, 6 years ago

Triage Stage: UnreviewedAccepted

comment:3 by Mariusz Felisiak, 6 years ago

Triage Stage: AcceptedReady for checkin

comment:4 by Tim Graham, 6 years ago

Summary: Bulk update does not support non-truthy primary keysQuerySet.bulk_update() doesn't support non-truthy primary keys

comment:5 by Tim Graham <timograham@…>, 6 years ago

Resolution: fixed
Status: newclosed

In 31408446:

Fixed #29974 -- Fixed non-truthy primary key values for QuerySet.bulk_update().

Note: See TracTickets for help on using tickets.
Back to Top