#22397: Issues removing M2M field with explicit through model
---------------------------------+------------------------------------
     Reporter:  melinath         |                    Owner:  andrewsg
         Type:  Bug              |                   Status:  new
    Component:  Migrations       |                  Version:  master
     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
---------------------------------+------------------------------------

Comment (by charettes):

 Looks like the following is solving it:

 {{{
 diff --git a/tests/migrations/test_state.py
 b/tests/migrations/test_state.py
 index 045ac6b..1c0224a 100644
 --- a/tests/migrations/test_state.py
 +++ b/tests/migrations/test_state.py
 @@ -293,14 +293,25 @@ class StateTests(TestCase):
          self.assertEqual(project_state == other_state, False)

      def test_dangling_references_throw_error(self):
 +        new_apps = Apps()
 +
          class Author(models.Model):
              name = models.TextField()
 +            class Meta:
 +                app_label = "migrations"
 +                apps = new_apps

          class Book(models.Model):
              author = models.ForeignKey(Author)
 +            class Meta:
 +                app_label = "migrations"
 +                apps = new_apps

          class Magazine(models.Model):
              authors = models.ManyToManyField(Author)
 +            class Meta:
 +                app_label = "migrations"
 +                apps = new_apps

          # Make a valid ProjectState and render it
          project_state = ProjectState()
 }}}

-- 
Ticket URL: <https://code.djangoproject.com/ticket/22397#comment:14>
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/066.5ddf64481914528443ccab4f579102d2%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to