From 85a3b0cd6b43c8ecebea281a01421fd58560a84d Mon Sep 17 00:00:00 2001 From: Trenton H <797416+stumpylog@users.noreply.github.com> Date: Tue, 21 Apr 2026 07:54:38 -0700 Subject: [PATCH] Prefetches the custom field instance and the custom field all at once --- src/documents/views.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/documents/views.py b/src/documents/views.py index 51b1abe96..a96c24502 100644 --- a/src/documents/views.py +++ b/src/documents/views.py @@ -968,7 +968,10 @@ class DocumentViewSet( ), ), "tags", - "custom_fields", + Prefetch( + "custom_fields", + queryset=CustomFieldInstance.objects.select_related("field"), + ), "notes", ) )