#31350 closed Bug (fixed)
.save() on list of entries will not work
| Reported by: | Shrikrishna Singh | Owned by: | Shrikrishna Singh |
|---|---|---|---|
| Component: | Documentation | Version: | 3.0 |
| Severity: | Normal | Keywords: | |
| Cc: | Triage Stage: | Accepted | |
| Has patch: | yes | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | yes | UI/UX: | no |
Description
I was going through the Database access optimization documentation.
And in the section [Update in bulk](https://docs.djangoproject.com/en/3.0/topics/db/optimization/#update-in-bulk), it is mentioned that:
entries = Entry.objects.bulk_create([
Entry(headline='This is a test'),
Entry(headline='This is only a test'),
])
After the bulk_create it possible to do:
entries[0].headline = 'This is not a test' entries.save() entries[1].headline = 'This is no longer a test' entries.save()
Which doesn't seem right, as entries is list which will not have attribute save(). Instead it should be entries[0].save() and entries[1].save().
This is a very small mistake. But I am willing to send a PR if someone verify this issue.
Change History (4)
comment:1 by , 6 years ago
| Triage Stage: | Unreviewed → Accepted |
|---|---|
| Type: | Uncategorized → Bug |
Note:
See TracTickets
for help on using tickets.
That's right, we would welcome a patch!