some parts of product - fix custom pagination - add id to pages list
This commit is contained in:
@@ -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
7
apps/core/pagination.py
Normal 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
|
||||
Reference in New Issue
Block a user