Fix: improve performance of listing result IDs (#5195)

This commit is contained in:
Antoine Libert 2024-01-01 16:58:43 +01:00 committed by GitHub
parent 670a3f6c7f
commit 54372b5618
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -56,11 +56,7 @@ class StandardPagination(PageNumberPagination):
except Exception:
pass
else:
for obj in self.page.paginator.object_list:
if hasattr(obj, "id"):
ids.append(obj.id)
elif hasattr(obj, "fields"):
ids.append(obj.fields()["id"])
ids = self.page.paginator.object_list.values_list("pk", flat=True)
return ids
def get_paginated_response_schema(self, schema):