From d4826f50c99216cd72105de15f0e6dd0fa19d04b Mon Sep 17 00:00:00 2001 From: shamoon <4887959+shamoon@users.noreply.github.com> Date: Mon, 19 Oct 2026 22:25:52 -0700 Subject: [PATCH] Fix: prevent doc permissions queries on schema view (#14503) --- src/documents/views.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/documents/views.py b/src/documents/views.py index a7e4350e8..0edae28d6 100644 --- a/src/documents/views.py +++ b/src/documents/views.py @@ -498,6 +498,11 @@ class BulkPermissionMixin: """ context = super().get_serializer_context() + if getattr(self, "swagger_fake_view", False): + # Schema generation only needs the serializer shape; without a + # paginated page we'd otherwise scan the entire queryset below. + return context + if getattr(self, "action", None) != "list": # Batching only pays off across a page of objects; for single-object # actions (retrieve, update, ...) the per-object fallback in