#22833: 1.7 migrations can't delete codependent "through" models
---------------------------------+--------------------------------------
     Reporter:  mozumder@…       |                    Owner:  nobody
         Type:  Bug              |                   Status:  new
    Component:  Migrations       |                  Version:  1.7-beta-2
     Severity:  Release blocker  |               Resolution:
     Keywords:                   |             Triage Stage:  Accepted
    Has patch:  0                |      Needs documentation:  0
  Needs tests:  0                |  Patch needs improvement:  0
Easy pickings:  0                |                    UI/UX:  0
---------------------------------+--------------------------------------
Changes (by bmispelon):

 * needs_better_patch:   => 0
 * stage:  Unreviewed => Accepted
 * severity:  Normal => Release blocker
 * needs_tests:   => 0
 * needs_docs:   => 0


Comment:

 Hi,

 I can indeed reproduce your issue with the following simplified models
 (the problem appears on `master` as well):
 {{{#!python
 from django.db import models

 class Foo(models.Model):
     bazes = models.ManyToManyField('Baz', through='Bar')


 class Bar(models.Model):
     foo = models.ForeignKey('Foo')
     baz = models.ForeignKey('Baz')


 class Baz(models.Model):
     pass
 }}}

 After running an initial `makemigrations && migrate`, I delete the first
 two models, then run `makemigrations` (which works, producing essentially
 the same migration as the one you describe). After that, running `migrate`
 triggers a `KeyError` like the one you reported.

 I'll bump the severity to `release blocker` since this use-case should be
 perfectly valid.

 Thanks.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/22833#comment:1>
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/081.63bfd78e1d7fc787c9811cc882eb047a%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to