Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Revert "[1.7.x] Fixed #22331 -- Fixed migrations ProjectState to igno…

…re unmanaged models."

This reverts commit bf69375.
  • Loading branch information...
commit d84beb3d9105300a94061dd94911a0c3cd9021d2 1 parent bf69375
Tim Graham timgraham authored
Showing with 2 additions and 14 deletions.
  1. +2 −3 django/db/migrations/state.py
  2. +0 −11 tests/migrations/test_state.py
5 django/db/migrations/state.py
View
@@ -58,9 +58,8 @@ def from_apps(cls, apps):
"Takes in an Apps and returns a ProjectState matching it"
app_models = {}
for model in apps.get_models():
- if model._meta.managed:
- model_state = ModelState.from_model(model)
- app_models[(model_state.app_label, model_state.name.lower())] = model_state
+ model_state = ModelState.from_model(model)
+ app_models[(model_state.app_label, model_state.name.lower())] = model_state
return cls(app_models)
def __eq__(self, other):
11 tests/migrations/test_state.py
View
@@ -52,22 +52,11 @@ class Meta:
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")
Please sign in to comment.
Something went wrong with that request. Please try again.