added limit-offset pagination to endpoints

This commit is contained in:
Sam
2021-02-17 13:32:36 +00:00
parent d53a49bf4c
commit 8c9fbfd77a
2 changed files with 14 additions and 1 deletions

View File

@@ -59,6 +59,18 @@ To load initial set of tags: `python manage.py addtaxonomy`
## Endpoints ## Endpoints
## Pagination
By default a `LimitOffsetPagination` pagination is enabled
Examples: `http://127.0.0.1:8000/api/v1/products/?limit=10&offset=0`
The response data has the following keyspayload:
```
dict_keys(['count', 'next', 'previous', 'results'])
```
### User Management ### User Management
Creation: Creation:

View File

@@ -123,7 +123,8 @@ REST_FRAMEWORK = {
'DEFAULT_AUTHENTICATION_CLASSES': [ 'DEFAULT_AUTHENTICATION_CLASSES': [
'rest_framework_simplejwt.authentication.JWTAuthentication', 'rest_framework_simplejwt.authentication.JWTAuthentication',
], ],
'DEFAULT_FILTER_BACKENDS': ['django_filters.rest_framework.DjangoFilterBackend'] 'DEFAULT_FILTER_BACKENDS': ['django_filters.rest_framework.DjangoFilterBackend'],
'DEFAULT_PAGINATION_CLASS': 'rest_framework.pagination.LimitOffsetPagination',
} }
# Internationalization # Internationalization