diff --git a/products/views.py b/products/views.py index a318bcb..3246e55 100644 --- a/products/views.py +++ b/products/views.py @@ -9,6 +9,7 @@ from django.conf import settings from django.db.models import Q # Create your views here. +from rest_framework import status from rest_framework import viewsets from rest_framework.response import Response from rest_framework.permissions import IsAuthenticatedOrReadOnly, IsAdminUser, IsAuthenticated @@ -127,7 +128,7 @@ def load_coop_products(request): logging.error(f"Could not parse {row}") return Response() except Exception as e: - return Response({"errors": {"details": str(type(e))}}) + return Response({"errors": {"details": str(type(e))}}, status=status.HTTP_500_INTERNAL_SERVER_ERROR) @api_view(['GET',]) # include allowed methods @@ -168,4 +169,4 @@ def product_search(request): product_serializer = ProductSerializer(result_set, many=True) return Response(data={"filters": filters, "products": product_serializer.data}) except Exception as e: - return Response({"errors": {"details": str(type(e))}}) + return Response({"errors": {"details": str(type(e))}}, status=status.HTTP_500_INTERNAL_SERVER_ERROR)