Opened 10 years ago

Closed 10 years ago

#24236 closed Bug (fixed)

Custom ManyToManyFields don't generate SQL database changes

Reported by: Markus Holtermann Owned by: Markus Holtermann
Component: Database layer (models, ORM) Version: 1.7
Severity: Release blocker Keywords:
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description (last modified by Andriy Sokolovskiy)

Regression introduced in 3d4a826174b7a411a03be39725e60c940944a7fe

If user writes a class, inherited from ManyToManyField ("custom" m2m field) and doesn't define a get_internal_type(): return "ManyToManyField the schema backends won't recognize it as a m2m field and thus don't treat it as such.

This breaks existing code.

Change History (11)

comment:1 by Andriy Sokolovskiy, 10 years ago

Description: modified (diff)

comment:2 by Markus Holtermann, 10 years ago

Has patch: set
Type: UncategorizedBug

comment:3 by Andriy Sokolovskiy, 10 years ago

Maybe bug is not here.
Related fields are not explicitly define the internal type. As I can see, non-related fields define it explicitly. (for example, https://github.com/django/django/blob/0f3ea8c0bc9c7f7f5e448b0b2137bc6351f5eae3/django/db/models/fields/__init__.py#L1785)

comment:4 by Tim Graham, 10 years ago

Triage Stage: UnreviewedAccepted

comment:5 by Markus Holtermann, 10 years ago

See also the discussion on the django- developers mailing list: https://groups.google.com/d/msg/django-developers/-zQL0skuPh0/zUHWeAph6yAJ

comment:6 by Tim Graham, 10 years ago

Needs documentation: set

comment:7 by Markus Holtermann, 10 years ago

Needs documentation: unset

comment:8 by Markus Holtermann, 10 years ago

Status: newassigned

comment:9 by Tim Graham, 10 years ago

Triage Stage: AcceptedReady for checkin

comment:10 by Markus Holtermann <info@…>, 10 years ago

In 37b50db09230f90827008cc8404675d8b4876c10:

[1.7.x] Refs #24236 -- Added regression test for 3d4a826174b7a411a03be39725e60c940944a7fe

Thanks irc user ris for the report

comment:11 by Markus Holtermann <info@…>, 10 years ago

Resolution: fixed
Status: assignedclosed

In f8c040e1676506e3bcba5f2744199fdcde430552:

[1.7.x] Fixed #24236 -- Treated inherited m2m fields as such if they don't define get_internal_type()

Regression introduced in 3d4a826174b7a411a03be39725e60c940944a7fe

Thanks IRC user ris for the report, Loïc Bistuer, Anssi Kääriäinen and
Andriy Sokolovskiy for the discussion and Tim Graham for the review.

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