Opened 8 years ago

Last modified 8 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 Daniel Hillier)

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.

Change History (1)

comment:1 by Daniel Hillier, 8 years ago

Description: modified (diff)
Owner: changed from daniel.hillier@… to Daniel Hillier

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

PR

Last edited 8 years ago by Tim Graham (previous) (diff)
Note: See TracTickets for help on using tickets.
Back to Top