Opened 16 years ago

Closed 16 years ago

Last modified 13 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

Description

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 16 years ago.
Contains a fix and regression tests for the reported bug.

Download all attachments as: .zip

Change History (5)

by Justin Lilly, 16 years ago

Attachment: m2m-inheritance.diff added

Contains a fix and regression tests for the reported bug.

comment:1 by Alex Gaynor, 16 years ago

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 by Jacob, 16 years ago

milestone: 1.1

comment:3 by Russell Keith-Magee, 16 years ago

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 by Jacob, 13 years ago

milestone: 1.1

Milestone 1.1 deleted

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