diff options
| author | Andrew Godwin <andrew@aeracode.org> | 2014-07-21 10:09:31 +0100 |
|---|---|---|
| committer | Andrew Godwin <andrew@aeracode.org> | 2014-07-21 10:09:58 +0100 |
| commit | ff8d715a0a62eb4d70e6c2bf38fa1113ed2899e5 (patch) | |
| tree | 98318a707febf209e8e3ec44c1b3288117ee6a55 | |
| parent | 2fb1939a9efae24560d41fbb7f6a280a1d2e8d06 (diff) | |
[1.7.x] Fixed #23039: Don't try to serialize unmanaged models in tests
| -rw-r--r-- | django/db/backends/creation.py | 2 | ||||
| -rw-r--r-- | tests/migration_test_data_persistence/models.py | 7 |
2 files changed, 8 insertions, 1 deletions
diff --git a/django/db/backends/creation.py b/django/db/backends/creation.py index 752eac75cd..ad9fe99ccb 100644 --- a/django/db/backends/creation.py +++ b/django/db/backends/creation.py @@ -409,7 +409,7 @@ class BaseDatabaseCreation(object): # Make a function to iteratively return every object def get_objects(): for model in sort_dependencies(app_list): - if not model._meta.proxy and router.allow_migrate(self.connection.alias, model): + if not model._meta.proxy and model._meta.managed and router.allow_migrate(self.connection.alias, model): queryset = model._default_manager.using(self.connection.alias).order_by(model._meta.pk.name) for obj in queryset.iterator(): yield obj diff --git a/tests/migration_test_data_persistence/models.py b/tests/migration_test_data_persistence/models.py index 1b0b795d2c..c1572d5ddf 100644 --- a/tests/migration_test_data_persistence/models.py +++ b/tests/migration_test_data_persistence/models.py @@ -3,3 +3,10 @@ from django.db import models class Book(models.Model): title = models.CharField(max_length=100) + + +class Unmanaged(models.Model): + title = models.CharField(max_length=100) + + class Meta: + managed = False |
