1
0
mirror of https://github.com/django/django.git synced 2025-10-24 14:16:09 +00:00

Fixed #22331 -- Made MigrationAutodetector ignore unmanaged models.

This commit reverts 69d4b1c and tackle the issue from a different angle.
Models remain present in the project state, but are now ignored by the
autodetector.
This commit is contained in:
Tim Graham
2014-03-25 18:30:29 -04:00
parent 378359de1c
commit 42336c84a0
4 changed files with 40 additions and 24 deletions

View File

@@ -52,22 +52,11 @@ class StateTests(TestCase):
verbose_name = "tome"
db_table = "test_tome"
class Unmanaged(models.Model):
title = models.CharField(max_length=1000)
class Meta:
app_label = "migrations"
apps = new_apps
managed = False
project_state = ProjectState.from_apps(new_apps)
author_state = project_state.models['migrations', 'author']
author_proxy_state = project_state.models['migrations', 'authorproxy']
sub_author_state = project_state.models['migrations', 'subauthor']
book_state = project_state.models['migrations', 'book']
# unmanaged models should not appear in migrations
with self.assertRaises(KeyError):
project_state.models['migrations', 'unmanaged']
self.assertEqual(author_state.app_label, "migrations")
self.assertEqual(author_state.name, "Author")