diff --git a/django/db/migrations/migration.py b/django/db/migrations/migration.py index e9af9cd994..4ebaa431ba 100644 --- a/django/db/migrations/migration.py +++ b/django/db/migrations/migration.py @@ -129,6 +129,7 @@ class Migration(object): operation.database_backwards(self.app_label, schema_editor, from_state, to_state) return project_state + def swappable_dependency(value): """ Turns a setting value into a dependency. diff --git a/tests/migrations/test_autodetector.py b/tests/migrations/test_autodetector.py index b033ed424f..2b8e940c4e 100644 --- a/tests/migrations/test_autodetector.py +++ b/tests/migrations/test_autodetector.py @@ -581,7 +581,7 @@ class AutodetectorTests(TestCase): the FK field before the model to maintain consistency. """ before = self.make_project_state([self.author_with_publisher, self.publisher]) - after = self.make_project_state([self.author_name]) # removes both the model and FK + after = self.make_project_state([self.author_name]) # removes both the model and FK autodetector = MigrationAutodetector(before, after) changes = autodetector._detect_changes() # Right number of migrations? @@ -603,7 +603,7 @@ class AutodetectorTests(TestCase): the field before the model to maintain consistency. """ before = self.make_project_state([self.book_with_multiple_authors_through_attribution, self.author_name, self.attribution]) - after = self.make_project_state([self.book_with_no_author, self.author_name]) # removes both the through model and ManyToMany + after = self.make_project_state([self.book_with_no_author, self.author_name]) # removes both the through model and ManyToMany autodetector = MigrationAutodetector(before, after) changes = autodetector._detect_changes() # Right number of migrations? diff --git a/tests/migrations/test_state.py b/tests/migrations/test_state.py index 1c0224ad52..8e55df6be7 100644 --- a/tests/migrations/test_state.py +++ b/tests/migrations/test_state.py @@ -297,18 +297,21 @@ class StateTests(TestCase): 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