From 44e60a705e4d3776d8745f9f673a7e2eaf9c0457 Mon Sep 17 00:00:00 2001 From: Oliver Walters Date: Sat, 9 Jan 2021 08:20:29 +1100 Subject: [PATCH] Add detail endpoints for the StockItemLabel and StockLocationLabel models --- InvenTree/label/api.py | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/InvenTree/label/api.py b/InvenTree/label/api.py index 714fceebec..8f3828410e 100644 --- a/InvenTree/label/api.py +++ b/InvenTree/label/api.py @@ -131,6 +131,15 @@ class StockItemLabelList(LabelListView): return queryset +class StockItemLabelDetail(generics.RetrieveUpdateDestroyAPIView): + """ + API endpoint for a single StockItemLabel object + """ + + queryset = StockItemLabel.objects.all() + serializer_class = StockItemLabelSerializer + + class StockLocationLabelList(LabelListView): """ API endpoint for viewiing list of StockLocationLabel objects. @@ -225,15 +234,36 @@ class StockLocationLabelList(LabelListView): return queryset +class StockLocationLabelDetail(generics.RetrieveUpdateDestroyAPIView): + """ + API endpoint for a single StockLocationLabel object + """ + + queryset = StockLocationLabel.objects.all() + seiralizer_class = StockLocationLabelSerializer + + label_api_urls = [ # Stock item labels url(r'stock/', include([ + # Detail views + url(r'^(?P\d+)/', include([ + url(r'^.*$', StockItemLabelDetail.as_view(), name='api-stockitem-label-detail'), + ])), + + # List view url(r'^.*$', StockItemLabelList.as_view(), name='api-stockitem-label-list'), ])), # Stock location labels url(r'location/', include([ + # Detail views + url(r'^(?P\d+)/', include([ + url(r'^.*$', StockLocationLabelDetail.as_view(), name='api-stocklocation-label-detail'), + ])), + + # List view url(r'^.*$', StockLocationLabelList.as_view(), name='api-stocklocation-label-list'), ])), ]