The Django REST framework provides many options to enable pagination. First, we will set up one of the customizable pagination styles included in the Django REST framework to include a maximum of four resources in each individual page of data.
Our RESTful Web Service uses the generic views that work with mixin classes. These classes are prepared to build paginated responses based on specific settings in the Django REST framework configuration. Hence, our RESTful Web Service will automatically take into account the pagination settings we configured, without requiring additional changes in the code.
restful01/restful01/settings.py file that declares module-level variables that define the configuration of Django for the
restful01 project. We will make some changes to this Django settings file. The code file for the sample is included in the
hillar_django_restful_07_01 folder, in the
restful01/restful01/settings.py file. Add the following lines that declare...