﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
25214	Behavior of  _meta.auto_created = True in m2m through model is not expected.	Chaoyi Du	nobody	"I have models like:

{{{

class A(models.Model):
    ...
    b = models.ManyToManyField(
        'B',
        through='Through',
    )
   ...

class B(models.Model):
   ...

class Through(models.Model):
    a = models.ForeignKey('A')
    b = models.ForeignKey('B')
    ...
    # other fields have default value

    class Meta:
        auto_created = False
}}}

If I make migrations at this point, joint table 'Through' will be created.

Then if I set ""Through._meta.auto_created = True"" somewhere, and never update migrations. Everything works well. If I add a new relationship between A instance and B instance, a through object will be created with default value, which looks great.

However if I update migrations, the ""Through"" model will be removed in migrations and everything break.

I think a through model with auto_created=True should be kept in migrations and when new relationships created, through objects shall be created with claimed default value.
     "	Bug	closed	Migrations	1.8	Normal	needsinfo			Unreviewed	0	0	0	0	0	0
