In the previous chapter, we took advantage of the pagination features available in Django REST Framework to specify how we wanted large results sets to be split into individual pages of data. However, we have always been working with the entire queryset
as the result set; that is, we didn't apply any filter.
Note
Django REST Framework makes it easy to customize filtering, searching, and sorting capabilities for the views we have already coded.
Open the settings.py
file in the games_service/games_service
folder. Add the following highlighted lines after the first line that declares the dictionary named REST_FRAMEWORK
to add the new 'DEFAULT_FILTER_BACKENDS'
setting key. Don't remove the lines that will appear after the new highlighted lines. We don't show them to avoid repeating code. The code file for the sample is included in the restful_python_2_08_01
folder, in the Django01/games-service/games_service/settings.py
file:
REST_FRAMEWORK...