44The DJA package implements a custom renderer, parser, exception handler, and
55pagination. To get started enable the pieces in ` settings.py ` that you want to use.
66
7- Many features of the JSON: API format standard have been implemented using Mixin classes in ` serializers.py ` .
8- The easiest way to make use of those features is to import ModelSerializer variants
7+ Many features of the JSON: API format standard have been implemented using Mixin classes in ` serializers.py ` .
8+ The easiest way to make use of those features is to import ModelSerializer variants
99from ` rest_framework_json_api ` instead of the usual ` rest_framework `
1010
1111### Configuration
12- We suggest that you simply copy the settings block below and modify it if necessary.
12+ We suggest that you copy the settings block below and modify it if necessary.
1313``` python
1414REST_FRAMEWORK = {
15- ' PAGINATE_BY' : 10 ,
16- ' PAGINATE_BY_PARAM' : ' page_size' ,
17- ' MAX_PAGINATE_BY' : 100 ,
18- # DRF v3.1+
15+ ' PAGE_SIZE' : 10 ,
16+ ' EXCEPTION_HANDLER' : ' rest_framework_json_api.exceptions.exception_handler' ,
1917 ' DEFAULT_PAGINATION_CLASS' :
2018 ' rest_framework_json_api.pagination.PageNumberPagination' ,
21- # older than DRF v3.1
22- ' DEFAULT_PAGINATION_SERIALIZER_CLASS' :
23- ' rest_framework_json_api.pagination.PaginationSerializer' ,
2419 ' DEFAULT_PARSER_CLASSES' : (
2520 ' rest_framework_json_api.parsers.JSONParser' ,
2621 ' rest_framework.parsers.FormParser' ,
@@ -30,12 +25,14 @@ REST_FRAMEWORK = {
3025 ' rest_framework_json_api.renderers.JSONRenderer' ,
3126 ' rest_framework.renderers.BrowsableAPIRenderer' ,
3227 ),
28+ ' DEFAULT_METADATA_CLASS' : ' rest_framework_json_api.metadata.JSONAPIMetadata' ,
3329}
3430```
3531
36- If ` PAGINATE_BY ` is set the renderer will return a ` meta ` object with
32+ If ` PAGE_SIZE ` is set the renderer will return a ` meta ` object with
3733record count and a ` links ` object with the next, previous, first, and last links.
38- Pages can be selected with the ` page ` GET parameter.
34+ Pages can be selected with the ` page ` GET parameter. Page size can be controlled
35+ per request via the ` PAGINATE_BY_PARAM ` query parameter (` page_size ` by default).
3936
4037### Setting the resource_name
4138
@@ -226,7 +223,7 @@ When set to pluralize:
226223}
227224```
228225
229- Both ` JSON_API_PLURALIZE_RELATION_TYPE ` and ` JSON_API_FORMAT_RELATION_KEYS ` can be combined to
226+ Both ` JSON_API_PLURALIZE_RELATION_TYPE ` and ` JSON_API_FORMAT_RELATION_KEYS ` can be combined to
230227achieve different results.
231228
232229### Meta
@@ -248,7 +245,7 @@ def get_root_meta(self, obj):
248245```
249246to the serializer. It must return a dict and will be merged with the existing top level ` meta ` .
250247
251- <!--
248+ <!--
252249### Relationships
253250### Links
254251### Included
0 commit comments