2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-07-09 07:00:56 +00:00

Do not generate parameter data on the server side when rendering part category templates

This commit is contained in:
Oliver Walters
2022-03-19 22:12:57 +11:00
parent 467febf9ea
commit c103f0c100
3 changed files with 3 additions and 20 deletions

View File

@ -1434,12 +1434,12 @@ class PartParameterTemplateList(generics.ListCreateAPIView):
queryset = queryset.filter(pk__in=[el[0] for el in template_ids])
except (ValueError, Part.DoesNotExist):
pass
# Filtering against a "PartCategory" - return only parameter templates which are referenced by parts in this category
category = params.get('category', None)
if category is not None:
try:
category = PartCategory.objects.get(pk=category)
cats = category.get_descendants(include_self=True)