mirror of
https://github.com/django/django.git
synced 2025-11-07 07:15:35 +00:00
[5.0.x] Fixed #35238 -- Fixed database serialization crash when base managers use prefetch_related().
Regression in1391356276following deprecation in eedbf930287cb72e9afab1f7208c24b1146b0c4ec. Backport ofa084c5d35afrom main
This commit is contained in:
committed by
Mariusz Felisiak
parent
e72fdc850a
commit
69e5b13c75
@@ -135,7 +135,10 @@ class BaseDatabaseCreation:
|
||||
queryset = model._base_manager.using(
|
||||
self.connection.alias,
|
||||
).order_by(model._meta.pk.name)
|
||||
yield from queryset.iterator()
|
||||
chunk_size = (
|
||||
2000 if queryset._prefetch_related_lookups else None
|
||||
)
|
||||
yield from queryset.iterator(chunk_size=chunk_size)
|
||||
|
||||
# Serialize to a string
|
||||
out = StringIO()
|
||||
|
||||
Reference in New Issue
Block a user