Opened 17 years ago
Closed 17 years ago
#5989 closed (fixed)
django.db.models.fields.subclassing.Creator.__get__() returns the same value for all instances
Reported by: | Luper Rouch | Owned by: | nobody |
---|---|---|---|
Component: | Database layer (models, ORM) | Version: | dev |
Severity: | Keywords: | subclassing SubfieldBase custom field | |
Cc: | Triage Stage: | Ready for checkin | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
I added a test to modeltests/field_subclassing/ that illustrates the problem (in patch).
I also made a simple fix, storing to_python()-ised data in a per object dict.
Attachments (1)
Change History (4)
by , 17 years ago
Attachment: | subclassing.patch added |
---|
comment:1 by , 17 years ago
comment:2 by , 17 years ago
Triage Stage: | Unreviewed → Ready for checkin |
---|
comment:3 by , 17 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Note:
See TracTickets
for help on using tickets.
Made a better version of the patch storing the to_python() value in the instance's dict, this way it gets destroyed with the instance without the need of a del method in Creator (thanks to Marty Alchin for explaining me that, see http://gulopine.gamemusic.org/2007/11/python-descriptors-part-2-of-2.html for details).