#25214: Behavior of _meta.auto_created = True in m2m through model is not
expected.
----------------------------+--------------------
Reporter: Cinkz | Owner: nobody
Type: Bug | Status: new
Component: Migrations | Version: 1.8
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
----------------------------+--------------------
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.
--
Ticket URL: <https://code.djangoproject.com/ticket/25214>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/048.73746dc4314e505f3faa283d8b14fe7a%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.