Kaydet (Commit) 2984b30c authored tarafından Andrew Godwin's avatar Andrew Godwin

Fixed #23039: Don't try to serialize unmanaged models in tests

üst 5875b8d1
...@@ -424,7 +424,7 @@ class BaseDatabaseCreation(object): ...@@ -424,7 +424,7 @@ class BaseDatabaseCreation(object):
# Make a function to iteratively return every object # Make a function to iteratively return every object
def get_objects(): def get_objects():
for model in sort_dependencies(app_list): 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) queryset = model._default_manager.using(self.connection.alias).order_by(model._meta.pk.name)
for obj in queryset.iterator(): for obj in queryset.iterator():
yield obj yield obj
......
...@@ -3,3 +3,10 @@ from django.db import models ...@@ -3,3 +3,10 @@ from django.db import models
class Book(models.Model): class Book(models.Model):
title = models.CharField(max_length=100) title = models.CharField(max_length=100)
class Unmanaged(models.Model):
title = models.CharField(max_length=100)
class Meta:
managed = False
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment