[Django] #37049: Changing a m2m through= from one custom model to another is no-op'd instead of raising an error

1 view
Skip to first unread message

Django

unread,
3:48 PM (6 hours ago) 3:48 PM
to django-...@googlegroups.com
#37049: Changing a m2m through= from one custom model to another is no-op'd instead
of raising an error
-------------------------------------+-------------------------------------
Reporter: Clifford | Owner: Clifford Gama
Gama |
Type: Bug | Status: assigned
Component: | Version: dev
Migrations | Keywords: migrations,
Severity: Normal | ManyToManyField, through
Triage Stage: | Has patch: 1
Unreviewed |
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------+-------------------------------------
Bug in b25aee3b7bef07dd07bed2209efcdf1a8146112c of ticket #22476.

The check to make changes to field options like `blank=True` on m2m's with
a custom through model no-ops is currently only checking that both through
models were non-auto-created
[https://github.com/django/django/blob/1b0d46f715849de53563aaf6912b4ded7d61641d/django/db/backends/base/schema.py#L882-L893
source], rather than verifying they are the same model. This means any two
custom through models would satisfy the check and short-circuit.

See regression test in attached PR for how to reproduce.
--
Ticket URL: <https://code.djangoproject.com/ticket/37049>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
3:53 PM (6 hours ago) 3:53 PM
to django-...@googlegroups.com
#37049: Changing a m2m through= from one custom model to another is no-op'd instead
of raising an error
-------------------------------------+-------------------------------------
Reporter: Clifford Gama | Owner: Clifford
| Gama
Type: Bug | Status: assigned
Component: Migrations | Version: dev
Severity: Normal | Resolution:
Keywords: migrations, | Triage Stage:
ManyToManyField, through | Unreviewed
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Description changed by Clifford Gama:

Old description:

> Bug in b25aee3b7bef07dd07bed2209efcdf1a8146112c of ticket #22476.
>
> The check to make changes to field options like `blank=True` on m2m's
> with a custom through model no-ops is currently only checking that both
> through models were non-auto-created
> [https://github.com/django/django/blob/1b0d46f715849de53563aaf6912b4ded7d61641d/django/db/backends/base/schema.py#L882-L893
> source], rather than verifying they are the same model. This means any
> two custom through models would satisfy the check and short-circuit.
>
> See regression test in attached PR for how to reproduce.

New description:

Bug in b25aee3b7bef07dd07bed2209efcdf1a8146112c of ticket #22476.

The check to make changes to field options like `blank=True` on m2m's with
a custom through model no-ops is currently only checking that both through
models were non-auto-created
[https://github.com/django/django/blob/1b0d46f715849de53563aaf6912b4ded7d61641d/django/db/backends/base/schema.py#L882-L893
source], rather than verifying they are the same model. This means any two
custom through models would satisfy the check and short-circuit.

See regression test in [https://github.com/django/django/pull/21131 PR]
for how to reproduce.

--
--
Ticket URL: <https://code.djangoproject.com/ticket/37049#comment:1>
Reply all
Reply to author
Forward
0 new messages