2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-12-16 01:08:12 +00:00

Prefetch to reduce hits

This commit is contained in:
Oliver Walters
2025-11-25 04:18:50 +00:00
parent b86bc2d6b8
commit a617cece72

View File

@@ -832,6 +832,8 @@ class ParameterTemplateFilter(FilterSet):
if not content_type:
return queryset.none()
queryset = queryset.prefetch_related('parameters')
# Annotate the queryset to determine which ParameterTemplates have at least one Parameter for the given model type
queryset = queryset.annotate(
parameter_count=SubqueryCount(