add: add product and category models

This commit is contained in:
behruz-dev
2025-08-28 16:43:33 +05:00
parent 53042ed25e
commit 8e4f79d856
32 changed files with 418 additions and 7 deletions

View File

@@ -0,0 +1,22 @@
from rest_framework.pagination import PageNumberPagination
from rest_framework.pagination import PageNumberPagination
from rest_framework.response import Response
class CustomPageNumberPagination(PageNumberPagination):
page_size = 10
page_query_param = 'page'
page_size_query_param = 'page_size'
max_page_size = 100
def get_paginated_response(self, data):
return Response({
'total': self.page.paginator.count,
'page': self.page.number,
'page_size': self.get_page_size(self.request),
'total_pages': self.page.paginator.num_pages,
'has_next': self.page.has_next(),
'has_previous': self.page.has_previous(),
'results': data
})