Permalink
Browse files

[1.7.x] Fixed #23039: Don't try to serialize unmanaged models in tests

  • Loading branch information...
andrewgodwin committed Jul 21, 2014
1 parent 2fb1939 commit ff8d715a0a62eb4d70e6c2bf38fa1113ed2899e5
Showing with 8 additions and 1 deletion.
  1. +1 −1 django/db/backends/creation.py
  2. +7 −0 tests/migration_test_data_persistence/models.py
@@ -409,7 +409,7 @@ def serialize_db_to_string(self):
# 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
@@ -3,3 +3,10 @@
class Book(models.Model):
title = models.CharField(max_length=100)
+
+
+class Unmanaged(models.Model):
+ title = models.CharField(max_length=100)
+
+ class Meta:
+ managed = False

0 comments on commit ff8d715

Please sign in to comment.