Opened 6 years ago

Closed 6 years ago

#12143 closed (fixed)

r11710 breaks recursive ManyToManyField

Reported by: knutin@… Owned by: nobody
Component: Database layer (models, ORM) Version: master
Severity: Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

Revision r11710(#10109) breaks recursive ManyToManyField, ie. ManyToManyField('self').

This appears to be caused by a change in the column names for intermediate tables(_get_m2m_attr() maybe).

Previous versions, for example 11709, generates column names like this: from_foo_id, to_foo_id.

Attachments (1)

m2m_fix.diff (620 bytes) - added by Alex 6 years ago.
Can you confirm whether this fixes the issue for you?

Download all attachments as: .zip

Change History (4)

comment:1 Changed 6 years ago by Alex

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

What names does it generate now? I thought I was pretty careful to make sure nothing had it's name changed.

comment:2 Changed 6 years ago by knutin

Output from sqlall before r11710:

CREATE TABLE "transport_transportorder_related_orders" (
    "id" serial NOT NULL PRIMARY KEY,
    "from_transportorder_id" integer NOT NULL REFERENCES "transport_transportorder" ("id") DEFERRABLE INITIALLY DEFERRED,
    "to_transportorder_id" integer NOT NULL REFERENCES "transport_transportorder" ("id") DEFERRABLE INITIALLY DEFERRED,
    UNIQUE ("from_transportorder_id", "to_transportorder_id")
)
;

After:

CREATE TABLE "transport_transportorder_related_orders" (
    "id" serial NOT NULL PRIMARY KEY,
    "from_transportorder_id" integer NOT NULL,
    "transportorder_id" integer NOT NULL,
    UNIQUE ("from_transportorder_id", "transportorder_id")
)
;

Changed 6 years ago by Alex

Can you confirm whether this fixes the issue for you?

comment:3 Changed 6 years ago by russellm

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

(In [11713]) Fixed #12143 -- Corrected the naming of the 'to' column in recursive m2m models. Thanks to knutin@… for the report, and Alex Gaynor for the patch.

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