mirror of
https://github.com/inventree/InvenTree.git
synced 2025-06-15 19:45:46 +00:00
PEP fixes
This commit is contained in:
@ -9,8 +9,6 @@ from django.conf import settings
|
|||||||
from django.conf.urls import url, include
|
from django.conf.urls import url, include
|
||||||
from django.urls import reverse
|
from django.urls import reverse
|
||||||
|
|
||||||
from django.db.models import Sum, Count
|
|
||||||
|
|
||||||
from .models import StockLocation, StockItem
|
from .models import StockLocation, StockItem
|
||||||
from .models import StockItemTracking
|
from .models import StockItemTracking
|
||||||
|
|
||||||
@ -268,7 +266,7 @@ class StockList(generics.ListCreateAPIView):
|
|||||||
queryset = self.filter_queryset(self.get_queryset())
|
queryset = self.filter_queryset(self.get_queryset())
|
||||||
|
|
||||||
# Instead of using the DRF serializer to LIST,
|
# Instead of using the DRF serializer to LIST,
|
||||||
# we will serialize the objects manually.
|
# we will serialize the objects manually.
|
||||||
# This is significantly faster
|
# This is significantly faster
|
||||||
|
|
||||||
data = queryset.values(
|
data = queryset.values(
|
||||||
@ -298,10 +296,13 @@ class StockList(generics.ListCreateAPIView):
|
|||||||
|
|
||||||
loc_id = item['location']
|
loc_id = item['location']
|
||||||
|
|
||||||
if loc_id not in locations:
|
if loc_id:
|
||||||
locations[loc_id] = StockLocation.objects.get(pk=loc_id).pathstring
|
if loc_id not in locations:
|
||||||
|
locations[loc_id] = StockLocation.objects.get(pk=loc_id).pathstring
|
||||||
item['location__path'] = locations[loc_id]
|
|
||||||
|
item['location__path'] = locations[loc_id]
|
||||||
|
else:
|
||||||
|
item['location__path'] = None
|
||||||
|
|
||||||
return Response(data)
|
return Response(data)
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user