product create fix error

This commit is contained in:
2026-04-18 16:36:11 +05:00
parent 0e627023c2
commit d91bee4970
2 changed files with 35 additions and 4 deletions

View File

@@ -1,6 +1,27 @@
from rest_framework.pagination import CursorPagination
from rest_framework.pagination import CursorPagination, PageNumberPagination
class VendorProductCursorPagination(CursorPagination):
page_size = 20
ordering = '-created_at'
cursor_query_param = 'cursor'
class VendorProductPagePagination(PageNumberPagination):
page_size = 20
page_size_query_param = 'page_size'
max_page_size = 100
def get_paginated_response(self, data):
from rest_framework.response import Response
return Response({
"total_items": self.page.paginator.count,
"total_pages": self.page.paginator.num_pages,
"page_size": self.get_page_size(self.request),
"current_page": self.page.number,
"links": {
"next": self.get_next_link(),
"previous": self.get_previous_link(),
},
"results": data,
})