If a custom `ManyToManyField` 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.
--
Ticket URL: <https://code.djangoproject.com/ticket/24236>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
Old description:
> Regression introduced in 3d4a826174b7a411a03be39725e60c940944a7fe
>
> If a custom `ManyToManyField` 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.
New description:
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.
--
--
Ticket URL: <https://code.djangoproject.com/ticket/24236#comment:1>
* has_patch: 0 => 1
* type: Uncategorized => Bug
Comment:
PR: https://github.com/django/django/pull/3998
--
Ticket URL: <https://code.djangoproject.com/ticket/24236#comment:2>
Comment (by coldmind):
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)
--
Ticket URL: <https://code.djangoproject.com/ticket/24236#comment:3>
* stage: Unreviewed => Accepted
--
Ticket URL: <https://code.djangoproject.com/ticket/24236#comment:4>
Comment (by MarkusH):
See also the discussion on the django- developers mailing list:
https://groups.google.com/d/msg/django-developers/-zQL0skuPh0/zUHWeAph6yAJ
--
Ticket URL: <https://code.djangoproject.com/ticket/24236#comment:5>
* needs_docs: 0 => 1
--
Ticket URL: <https://code.djangoproject.com/ticket/24236#comment:6>
* needs_docs: 1 => 0
--
Ticket URL: <https://code.djangoproject.com/ticket/24236#comment:7>
* status: new => assigned
--
Ticket URL: <https://code.djangoproject.com/ticket/24236#comment:8>
* stage: Accepted => Ready for checkin
--
Ticket URL: <https://code.djangoproject.com/ticket/24236#comment:9>
Comment (by Markus Holtermann <info@…>):
In [changeset:"37b50db09230f90827008cc8404675d8b4876c10"]:
{{{
#!CommitTicketReference repository=""
revision="37b50db09230f90827008cc8404675d8b4876c10"
[1.7.x] Refs #24236 -- Added regression test for
3d4a826174b7a411a03be39725e60c940944a7fe
Thanks irc user ris for the report
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/24236#comment:10>
* status: assigned => closed
* resolution: => fixed
Comment:
In [changeset:"f8c040e1676506e3bcba5f2744199fdcde430552"]:
{{{
#!CommitTicketReference repository=""
revision="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.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/24236#comment:11>