mirror of
https://github.com/inventree/InvenTree.git
synced 2025-12-16 09:18:10 +00:00
Prefetch to reduce hits
This commit is contained in:
@@ -832,6 +832,8 @@ class ParameterTemplateFilter(FilterSet):
|
|||||||
if not content_type:
|
if not content_type:
|
||||||
return queryset.none()
|
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
|
# Annotate the queryset to determine which ParameterTemplates have at least one Parameter for the given model type
|
||||||
queryset = queryset.annotate(
|
queryset = queryset.annotate(
|
||||||
parameter_count=SubqueryCount(
|
parameter_count=SubqueryCount(
|
||||||
|
|||||||
Reference in New Issue
Block a user