Opened 9 years ago
Last modified 9 years ago
#27594 closed Bug
Reverse one to one related object populated from incorrect query columns — at Version 1
| Reported by: | Daniel Hillier | Owned by: | Daniel Hillier |
|---|---|---|---|
| Component: | Database layer (models, ORM) | Version: | dev |
| Severity: | Normal | Keywords: | onetoone reverse |
| Cc: | daniel.hillier@… | 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 )
Extracting data for the related object from a queryset with a self referential one to one field gets the wrong data (incorrect columns) from the query when using a select_related with the reverse field.
The incorrect columns are introduced by the sqlcompiler mistaking the reverse select_related path as a part of a multiple concrete model inheritance structure.
Note:
See TracTickets
for help on using tickets.
The proposed fix tests for self-referential relationships and avoids the multiple concrete model inheritance path in those instances.
PR