2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-07-02 03:30:54 +00:00

New approach for multiple annotations

- Use the django-sql-utils addon - https://github.com/martsberger/django-sql-utils
- The "distinct=True" flag was not doing what I thought it was doing...
This commit is contained in:
Oliver Walters
2020-09-05 22:35:19 +10:00
parent 2667dc68d7
commit 42967905bc
4 changed files with 44 additions and 17 deletions

View File

@ -377,6 +377,7 @@ class PartList(generics.ListCreateAPIView):
def get_queryset(self, *args, **kwargs):
queryset = super().get_queryset(*args, **kwargs)
queryset = part_serializers.PartSerializer.prefetch_queryset(queryset)
queryset = part_serializers.PartSerializer.annotate_queryset(queryset)