Opened 10 years ago

Closed 9 years ago

Last modified 7 years ago

#10237 closed (fixed)

Symmetry is lost when inheriting a self-referential m2m field

Reported by: Justin Lilly Owned by: Justin Lilly
Component: Database layer (models, ORM) Version: 1.0
Severity: Keywords: mti, m2m, inheritance
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


When extending a model (via MTI, not ABC), the implicit symmetrical=True reference wasn't being maintained because the current class was being checked against the parent (which weren't the same type). By changing this to an isinstance call instead of a __class__ comparison, it properly compares to parent objects.

Attachments (1)

m2m-inheritance.diff (2.2 KB) - added by Justin Lilly 10 years ago.
Contains a fix and regression tests for the reported bug.

Download all attachments as: .zip

Change History (5)

Changed 10 years ago by Justin Lilly

Attachment: m2m-inheritance.diff added

Contains a fix and regression tests for the reported bug.

comment:1 Changed 10 years ago by Alex Gaynor

Triage Stage: UnreviewedAccepted

Patch applies and works correctly for me, seems to solve the problem correctly(that code was originally from way back to magic-removal).

comment:2 Changed 10 years ago by Jacob

milestone: 1.1

comment:3 Changed 9 years ago by Russell Keith-Magee

Resolution: fixed
Status: newclosed

(In [10550]) Fixed #10237 -- Corrected the handling of self-referential m2m fields when using multi-table inheritance. Thanks to Justin Lilly for the report and patch.

comment:4 Changed 7 years ago by Jacob

milestone: 1.1

Milestone 1.1 deleted

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