Open the views.py
file in the games_service/games
folder. Add the following code after the last line that declares the imports, before the declaration of the UserList
class. The code file for the sample is included in the restful_python_2_08_01
folder, in the Django01/games-service/games/views.py
file:
from rest_framework import filters from django_filters import AllValuesFilter, DateTimeFilter, NumberFilter from django_filters.rest_framework import FilterSet
Stay editing the views.py
file in the games_service/games
folder. Add the following highlighted lines to the EsrbRatingList
class declared in the views.py
file. Don't remove the existing lines for this class that isn't shown 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/views.py
file:
class EsrbRatingList(generics.ListCreateAPIView):
filterset_fields = ('description',)
search_fields...