mirror of
https://github.com/inventree/InvenTree.git
synced 2025-06-20 13:56:30 +00:00
Major major major (improvements for StockItem list API)
OK LISTEN UP - Lots of work went into making this speedier: - For related detail fields (e.g. part_detail), we pre-fetch and cache the model data - This eliminates duplicate database hits for the same model instances - Perform all field filtering manually, rather than using the DRF 'filter_fields' concept (this seems to add a lot of overhead) - Use query annotations to getch calculated fields rather than fetching one-at-a-time - And finally, if the request is AJAX then return a JsonResponse which is SO FREAKING MUCH FASTER
This commit is contained in:
@ -293,10 +293,10 @@ class PartList(generics.ListCreateAPIView):
|
||||
|
||||
def filter_queryset(self, queryset):
|
||||
"""
|
||||
Perform custom filtering of the queryset
|
||||
Perform custom filtering of the queryset.
|
||||
We overide the DRF filter_fields here because
|
||||
"""
|
||||
|
||||
# Perform basic filtering
|
||||
queryset = super().filter_queryset(queryset)
|
||||
|
||||
# Filter by 'starred' parts?
|
||||
|
Reference in New Issue
Block a user