Opened 8 years ago

Last modified 8 years ago

#27594 closed Bug

Reverse one to one related object populated from incorrect query columns — at Initial Version

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

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.

The proposed fix tests for self-referential relationships and avoids the multiple concrete model inheritance path in those instances.

Test added and all other tests are passing.

Change History (0)

Note: See TracTickets for help on using tickets.
Back to Top