Opened 8 years ago

Last modified 8 years ago

#26787 closed Cleanup/optimization

Access to deleted attribute triggers a query — at Version 1

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 (last modified by Julien Hartmann)

This is a consequence of the implementation of #26207 in PR 6118

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.

Change History (1)

comment:1 by Julien Hartmann, 8 years ago

Description: modified (diff)
Note: See TracTickets for help on using tickets.
Back to Top