Git repository: https://github.com/SentientClee/django-bug-reproduction
Here is the `accounts` app `model.py` code.
{{{#!python
from django.conf import settings
from django.contrib.auth.models import AbstractUser
from django.db import models
class User(AbstractUser):
pass
class Test(models.Model):
members = models.ManyToManyField(settings.AUTH_USER_MODEL)
}}}
Here is one of the erroneous migrations. Notice it depends on
`0002_alter_test_members` which is an erroneous migrations file that looks
just like this one.
{{{#!python
# Generated by Django 4.0.2 on 2022-02-15 01:33
from django.conf import settings
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('accounts', '0002_alter_test_members'),
]
operations = [
migrations.AlterField(
model_name='test',
name='members',
field=models.ManyToManyField(to=settings.AUTH_USER_MODEL),
),
]
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/33515>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
Ticket URL: <https://code.djangoproject.com/ticket/33515#comment:1>
* cc: Simon Charette, David Wobrock (added)
* severity: Normal => Release blocker
* stage: Unreviewed => Accepted
Comment:
Thanks for the report!
Lowercased `AUTH_USER_MODEL = 'accounts.user'` is crucial to reproduce
this issue.
Regression in 43289707809c814a70f0db38ca4f82f35f43dbfd.
--
Ticket URL: <https://code.djangoproject.com/ticket/33515#comment:2>
* owner: nobody => Mariusz Felisiak
* status: new => assigned
--
Ticket URL: <https://code.djangoproject.com/ticket/33515#comment:3>
* has_patch: 0 => 1
Comment:
[https://github.com/django/django/pull/15433 PR]
--
Ticket URL: <https://code.djangoproject.com/ticket/33515#comment:4>
* status: assigned => closed
* resolution: => fixed
Comment:
In [changeset:"1e2e1be02bdf0fe4add0d0279dbca1d74ae28ad7" 1e2e1be]:
{{{
#!CommitTicketReference repository=""
revision="1e2e1be02bdf0fe4add0d0279dbca1d74ae28ad7"
Fixed #33515 -- Prevented recreation of migration for ManyToManyField to
lowercased swappable setting.
Thanks Chris Lee for the report.
Regression in 43289707809c814a70f0db38ca4f82f35f43dbfd.
Refs #23916.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/33515#comment:5>
Comment (by Mariusz Felisiak <felisiak.mariusz@…>):
In [changeset:"760b7e7f4f62eafdc79a2188d2a7739abaa6ca8b" 760b7e7f]:
{{{
#!CommitTicketReference repository=""
revision="760b7e7f4f62eafdc79a2188d2a7739abaa6ca8b"
[4.0.x] Fixed #33515 -- Prevented recreation of migration for
ManyToManyField to lowercased swappable setting.
Thanks Chris Lee for the report.
Regression in 43289707809c814a70f0db38ca4f82f35f43dbfd.
Refs #23916.
Backport of 1e2e1be02bdf0fe4add0d0279dbca1d74ae28ad7 from main
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/33515#comment:6>