APIView class defines default settings for each view that we can override by specifying the desired values in the settings module, that is, the
restful01/settings.py file. It is also possible to override the class attributes in subclasses. In this case, we won't make changes in the settings module, but we have to understand which are the default settings that the
APIView class uses. We added the
@api_view decorator, and it automatically makes the
APIView use these settings.
The value for the
DEFAULT_PARSER_CLASSES setting key specifies a tuple of string whose values indicate the default classes that we want to use for parsing backends. The following lines show the default values:
( 'rest_framework.parsers.JSONParser', 'rest_framework.parsers.FormParser', 'rest_framework.parsers.MultiPartParser' )
When we use the
@api_view decorator, the RESTful Web Service will be able to handle any of the following content types through...