mirror of
https://github.com/inventree/InvenTree.git
synced 2025-07-06 05:30:56 +00:00
Working towards better build allocation:
- Improve data serialization in API - Javascript bug fixes - Load the build allocation table using jQuery
This commit is contained in:
@ -95,20 +95,25 @@ class BuildItemList(generics.ListCreateAPIView):
|
||||
to allow filtering by stock_item.part
|
||||
"""
|
||||
|
||||
# Does the user wish to filter by part?
|
||||
part_pk = self.request.query_params.get('part', None)
|
||||
|
||||
query = BuildItem.objects.all()
|
||||
|
||||
query = query.select_related('stock_item')
|
||||
query = query.prefetch_related('stock_item__part')
|
||||
query = query.prefetch_related('stock_item__part__category')
|
||||
|
||||
if part_pk:
|
||||
query = query.filter(stock_item__part=part_pk)
|
||||
|
||||
return query
|
||||
|
||||
def filter_queryset(self, queryset):
|
||||
queryset = super().filter_queryset(queryset)
|
||||
|
||||
# Does the user wish to filter by part?
|
||||
part_pk = self.request.query_params.get('part', None)
|
||||
|
||||
if part_pk:
|
||||
queryset = queryset.filter(stock_item__part=part_pk)
|
||||
|
||||
return queryset
|
||||
|
||||
permission_classes = [
|
||||
permissions.IsAuthenticated,
|
||||
]
|
||||
@ -128,7 +133,7 @@ build_item_api_urls = [
|
||||
]
|
||||
|
||||
build_api_urls = [
|
||||
url(r'^item/?', include(build_item_api_urls)),
|
||||
url(r'^item/', include(build_item_api_urls)),
|
||||
|
||||
url(r'^(?P<pk>\d+)/', BuildDetail.as_view(), name='api-build-detail'),
|
||||
|
||||
|
Reference in New Issue
Block a user