#18996 closed Cleanup/optimization (fixed)
better document overridden model save not called on bulk update.
Reported by: | Owned by: | nobody | |
---|---|---|---|
Component: | Documentation | Version: | 1.4 |
Severity: | Normal | Keywords: | docs overriding save bulk update |
Cc: | tomas.ehrlich@… | Triage Stage: | Accepted |
Has patch: | yes | Needs documentation: | yes |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | yes | UI/UX: | no |
Description
The documentation on overriding predefined model methods should mention that bulk updates do no trigger customized save methods. I.e. if I do MyModel.objects.all().update(a=5) will not trigger MyModel.save().
The docs do already mention this in the description of update( ) but not in the description of overriding methods:
https://docs.djangoproject.com/en/dev/topics/db/models/#overriding-predefined-model-methods
Attachments (3)
Change History (12)
comment:1 by , 12 years ago
Needs documentation: | set |
---|---|
Summary: | Overriding predefined model methods vs bulk update. → better document overridden model save not called on bulk update. |
Triage Stage: | Unreviewed → Accepted |
Type: | Uncategorized → Cleanup/optimization |
by , 12 years ago
Attachment: | 18996-1.diff added |
---|
comment:2 by , 12 years ago
Has patch: | set |
---|
comment:3 by , 12 years ago
Patch needs improvement: | set |
---|
The patch isn't correct - you can't use pre/post_save for update operations. In addition, bulk_create would be good to mention at the same time, too. It is a bit sad that there isn't anything you can use for .update() operations currently...
comment:4 by , 12 years ago
Cc: | added |
---|
comment:5 by , 12 years ago
Patch needs improvement: | unset |
---|
comment:7 by , 12 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Improved documentation