Code

Opened 5 years ago

Closed 5 years ago

Last modified 3 years ago

#10237 closed (fixed)

Symmetry is lost when inheriting a self-referential m2m field

Reported by: justinlilly Owned by: justinlilly
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: UI/UX:

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

Download all attachments as: .zip

Change History (5)

Changed 5 years ago by justinlilly

Contains a fix and regression tests for the reported bug.

comment:1 Changed 5 years ago by Alex

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Accepted

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 5 years ago by jacob

  • milestone set to 1.1

comment:3 Changed 5 years ago by russellm

  • Resolution set to fixed
  • Status changed from new to closed

(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 3 years ago by jacob

  • milestone 1.1 deleted

Milestone 1.1 deleted

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.