Understanding the possibility of rendering text/HTML content
In Chapter 14, Using Generalized Behavior from the APIView Class, we made many changes to make it possible for the simple RESTful Web Service to work with a content negotiation class and provide many content renderers. We used the default configuration for the Django REST framework that includes a renderer that produces text/html
content.
The rest_framework.response.BrowsableAPIRenderer
class is responsible for rendering the text/html
content. This class makes it possible for us to browse the API. The Django REST framework includes a feature that generates an interactive and human-friendly HTML output for the different resources when the request specifies text/html
as the value for the Content-Type
key in the request header. This feature is known as the browsable API because it enables us to use a web browser to navigate through the API and easily make different types of HTTP requests.
Note
The browsable API feature is extremely useful...