From f87fd609e30053496837948e647259bfab83d235 Mon Sep 17 00:00:00 2001 From: Mojtaba-z Date: Sat, 19 Jul 2025 11:10:05 +0330 Subject: [PATCH] celery & attributes list by product-2 --- apps/product/web/api/v1/viewsets/product_api.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/apps/product/web/api/v1/viewsets/product_api.py b/apps/product/web/api/v1/viewsets/product_api.py index 174fcae..b1db6f6 100644 --- a/apps/product/web/api/v1/viewsets/product_api.py +++ b/apps/product/web/api/v1/viewsets/product_api.py @@ -135,8 +135,11 @@ class AttributeViewSet(viewsets.ModelViewSet): attributes = self.queryset.filter(Q(is_global=True) | Q(product__id=pk)) - serializer = self.serializer_class(attributes, many=True) - return Response(serializer.data) + # paginate data + page = self.paginate_queryset(attributes) + if page is not None: + serializer = self.get_serializer(page, many=True) + return self.get_paginated_response(serializer.data) @action( methods=['put'],