diff --git a/InvenTree/company/templates/company/index.html b/InvenTree/company/templates/company/index.html index f110950c0b..ae3e191bc1 100644 --- a/InvenTree/company/templates/company/index.html +++ b/InvenTree/company/templates/company/index.html @@ -15,7 +15,9 @@ InvenTree | {% trans "Supplier List" %} {% if pagetype == 'manufacturers' and roles.purchase_order.add or pagetype == 'suppliers' and roles.purchase_order.add or pagetype == 'customers' and roles.sales_order.add %}
{% endif %} diff --git a/InvenTree/part/api.py b/InvenTree/part/api.py index 496153a6d0..c96cff6da5 100644 --- a/InvenTree/part/api.py +++ b/InvenTree/part/api.py @@ -186,18 +186,29 @@ class PartTestTemplateList(generics.ListCreateAPIView): class PartThumbs(generics.ListAPIView): - """ API endpoint for retrieving information on available Part thumbnails """ + """ + API endpoint for retrieving information on available Part thumbnails + """ + queryset = Part.objects.all() serializer_class = part_serializers.PartThumbSerializer + def get_queryset(self): + + queryset = super().get_queryset() + + # Get all Parts which have an associated image + queryset = queryset.exclude(image='') + + return queryset + def list(self, request, *args, **kwargs): """ Serialize the available Part images. - Images may be used for multiple parts! """ - # Get all Parts which have an associated image - queryset = Part.objects.all().exclude(image='') + queryset = self.get_queryset() # TODO - We should return the thumbnails here, not the full image! diff --git a/InvenTree/part/test_api.py b/InvenTree/part/test_api.py index 328ad3ef9e..131936b8bd 100644 --- a/InvenTree/part/test_api.py +++ b/InvenTree/part/test_api.py @@ -241,6 +241,17 @@ class PartAPITest(APITestCase): self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST) + def test_get_thumbs(self): + """ + Return list of part thumbnails + """ + + url = reverse('api-part-thumbs') + + response = self.client.get(url) + + self.assertEqual(response.status_code, status.HTTP_200_OK) + class PartAPIAggregationTest(APITestCase): """