Opened 8 years ago
Last modified 8 years ago
#26787 closed Cleanup/optimization
Access to deleted attribute triggers a query — at Initial Version
Reported by: | Julien Hartmann | Owned by: | nobody |
---|---|---|---|
Component: | Documentation | Version: | 1.10 |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Accepted | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
This is a consequence of the implementation of #26207.
Now, all fields have a DeferredAttribute
descriptor. This has the consequence that this will trigger a model reload:
obj = MyModel.objects.get(pk=1) del obj.title obj.title
Up to version 1.9 (included), this code would raise an AttributeError
. Now it silently triggers a query to reload the field from the database.
Is this intended? If so, it should probably be added to the release notes.
Note:
See TracTickets
for help on using tickets.