Opened 7 years ago
Closed 7 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:1 by , 7 years ago
comment:2 by , 7 years ago
| Triage Stage: | Unreviewed → Accepted |
|---|
comment:3 by , 7 years ago
| Triage Stage: | Accepted → Ready for checkin |
|---|
comment:4 by , 7 years ago
| Summary: | Bulk update does not support non-truthy primary keys → QuerySet.bulk_update() doesn't support non-truthy primary keys |
|---|
Note:
See TracTickets
for help on using tickets.
Patch: https://github.com/django/django/pull/10674