mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Change view queryset from .all() to .none() (#3125)
- For some reason, the reverse URL lookups would fail for stock items which were not "in stock" - e.g. detail pages for stock items would fail to render if the stock item was "destroyed" or "quarantined" - changing the queryset to .none() fixed this - I do not know why...
This commit is contained in:
parent
b20fa1df9a
commit
0c8bb7328a
@ -90,6 +90,8 @@ class StockMetadata(generics.RetrieveUpdateAPIView):
|
|||||||
class StockItemContextMixin:
|
class StockItemContextMixin:
|
||||||
"""Mixin class for adding StockItem object to serializer context."""
|
"""Mixin class for adding StockItem object to serializer context."""
|
||||||
|
|
||||||
|
queryset = StockItem.objects.none()
|
||||||
|
|
||||||
def get_serializer_context(self):
|
def get_serializer_context(self):
|
||||||
"""Extend serializer context."""
|
"""Extend serializer context."""
|
||||||
context = super().get_serializer_context()
|
context = super().get_serializer_context()
|
||||||
@ -106,7 +108,6 @@ class StockItemContextMixin:
|
|||||||
class StockItemSerialize(StockItemContextMixin, generics.CreateAPIView):
|
class StockItemSerialize(StockItemContextMixin, generics.CreateAPIView):
|
||||||
"""API endpoint for serializing a stock item."""
|
"""API endpoint for serializing a stock item."""
|
||||||
|
|
||||||
queryset = StockItem.objects.all()
|
|
||||||
serializer_class = StockSerializers.SerializeStockItemSerializer
|
serializer_class = StockSerializers.SerializeStockItemSerializer
|
||||||
|
|
||||||
|
|
||||||
@ -118,21 +119,18 @@ class StockItemInstall(StockItemContextMixin, generics.CreateAPIView):
|
|||||||
- stock_item must be serialized (and not belong to another item)
|
- stock_item must be serialized (and not belong to another item)
|
||||||
"""
|
"""
|
||||||
|
|
||||||
queryset = StockItem.objects.all()
|
|
||||||
serializer_class = StockSerializers.InstallStockItemSerializer
|
serializer_class = StockSerializers.InstallStockItemSerializer
|
||||||
|
|
||||||
|
|
||||||
class StockItemUninstall(StockItemContextMixin, generics.CreateAPIView):
|
class StockItemUninstall(StockItemContextMixin, generics.CreateAPIView):
|
||||||
"""API endpoint for removing (uninstalling) items from this item."""
|
"""API endpoint for removing (uninstalling) items from this item."""
|
||||||
|
|
||||||
queryset = StockItem.objects.all()
|
|
||||||
serializer_class = StockSerializers.UninstallStockItemSerializer
|
serializer_class = StockSerializers.UninstallStockItemSerializer
|
||||||
|
|
||||||
|
|
||||||
class StockItemReturn(StockItemContextMixin, generics.CreateAPIView):
|
class StockItemReturn(StockItemContextMixin, generics.CreateAPIView):
|
||||||
"""API endpoint for returning a stock item from a customer"""
|
"""API endpoint for returning a stock item from a customer"""
|
||||||
|
|
||||||
queryset = StockItem.objects.all()
|
|
||||||
serializer_class = StockSerializers.ReturnStockItemSerializer
|
serializer_class = StockSerializers.ReturnStockItemSerializer
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user