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

Fixed stock URLs and API docs

This commit is contained in:
Oliver Walters
2017-04-15 23:14:05 +10:00
parent 71d7895148
commit 4259c6f9eb
4 changed files with 53 additions and 17 deletions

View File

@ -10,13 +10,24 @@ from .serializers import StockItemSerializer, LocationSerializer
class StockDetail(generics.RetrieveUpdateDestroyAPIView):
"""
get:
Return a single StockItem object
post:
Update a StockItem
delete:
Remove a StockItem
"""
queryset = StockItem.objects.all()
serializer_class = StockItemSerializer
permission_classes = (permissions.IsAuthenticatedOrReadOnly,)
class StockFilter(django_filters.rest_framework.FilterSet):
class StockFilter(FilterSet):
min_stock = NumberFilter(name='quantity', lookup_expr='gte')
max_stock = NumberFilter(name='quantity', lookup_expr='lte')
part = NumberFilter(name='part', lookup_expr='exact')
@ -28,6 +39,15 @@ class StockFilter(django_filters.rest_framework.FilterSet):
class StockList(generics.ListCreateAPIView):
"""
get:
Return a list of all StockItem objects
(with optional query filters)
post:
Create a new StockItem
"""
queryset = StockItem.objects.all()
serializer_class = StockItemSerializer
@ -37,7 +57,17 @@ class StockList(generics.ListCreateAPIView):
class LocationDetail(generics.RetrieveUpdateDestroyAPIView):
""" Return information on a specific stock location
"""
get:
Return a single StockLocation object
post:
Update a StockLocation object
delete:
Remove a StockLocation object
"""
queryset = StockLocation.objects.all()
@ -55,8 +85,15 @@ class StockLocationFilter(FilterSet):
class LocationList(generics.ListCreateAPIView):
""" Return a list of top-level locations
Locations are considered "top-level" if they do not have a parent
"""
get:
Return a list of all StockLocation objects
(with optional query filter)
post:
Create a new StockLocation
"""
queryset = StockLocation.objects.all()