1
0
mirror of https://github.com/django/django.git synced 2025-11-07 07:15:35 +00:00

Fixed #35159 -- Fixed dumpdata crash when base querysets use prefetch_related().

Regression in 1391356276
following deprecation in edbf930287.

Thanks Andrea F for the report.
This commit is contained in:
Mariusz Felisiak
2024-01-31 16:10:05 +01:00
committed by GitHub
parent d3922e9e5a
commit 38eaf2f21a
4 changed files with 30 additions and 1 deletions

View File

@@ -219,7 +219,10 @@ class Command(BaseCommand):
if count_only:
yield queryset.order_by().count()
else:
yield from queryset.iterator()
chunk_size = (
2000 if queryset._prefetch_related_lookups else None
)
yield from queryset.iterator(chunk_size=chunk_size)
try:
self.stdout.ending = None