some parts of product - fix custom pagination - add id to pages list

This commit is contained in:
2025-06-07 09:18:27 +03:30
parent a6cd093665
commit 627acf05a1
41 changed files with 371 additions and 4 deletions

View File

@@ -7,8 +7,9 @@ def custom_exception_handler(exc, context):
if response is not None:
response.data['status_code'] = response.status_code
response.data['message'] = response.data.get('detail', str(exc))
del response.data['detail']
if response.data.get('detail'):
response.data['message'] = response.data.get('detail', str(exc))
del response.data['detail']
else:
response = JsonResponse({'message': str(exc), 'status_code': 500})
response.status_code = 500

7
apps/core/pagination.py Normal file
View File

@@ -0,0 +1,7 @@
from rest_framework.pagination import PageNumberPagination
class CustomPageNumberPagination(PageNumberPagination):
page_size = 20 # default
page_size_query_param = 'page_size' # set from client
max_page_size = 100 # maximum items to show