Skip to content

A community-supported supercharged document management system: scan, index and archive all your documents

Fix: Prefetches the custom field instance and the custom field all at once (#12617)

Trenton H6017b11c42ca
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",
)
)