Using the default parsing and rendering options and moving beyond JSON

The APIView class specifies default settings for each view that we can override by specifying appropriate values in the games_service/settings.py file or by overriding the class attributes in subclasses of the APIView superclass. As we learned, the usage of the APIView class under the hoods makes the decorator apply these default settings. Thus, whenever we use the decorator, the default parser classes and the default renderer classes will be associated with the function views.

By default, the value for the DEFAULT_PARSER_CLASSES configuration variable is the following tuple of strings with three parser class names:

( 'rest_framework.parsers.JSONParser', 'rest_framework.parsers.FormParser', ...

Get Hands-On RESTful Python Web Services - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.