Opened 15 years ago

Closed 15 years ago

#12143 closed (fixed)

r11710 breaks recursive ManyToManyField

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

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 Gaynor 15 years ago.
Can you confirm whether this fixes the issue for you?

Download all attachments as: .zip

Change History (4)

comment:1 by Alex Gaynor, 15 years ago

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

comment:2 by Knut Nesheim, 15 years ago

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")
)
;

by Alex Gaynor, 15 years ago

Attachment: m2m_fix.diff added

Can you confirm whether this fixes the issue for you?

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

Resolution: fixed
Status: newclosed

(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