Under the hoods, the
@api_view
decorator is:A wrapper that converts a function-based view into a subclass of the
rest_framework.views.APIView
class.A wrapper that converts a function-based view into a serializer.
A wrapper that converts a function-based view into a subclass of the
rest_framework.views.api_view
class.
The browsable API, a feature included in Django REST Framework that:
Generates human-friendly JSON output for each resource whenever the request specifies
application/json
as the value for theContent-type
key in the request header.Generates human-friendly HTML output for each resource whenever the request specifies
text/html
as the value for theContent-type
key in the request header.Generates human-friendly HTML output for each resource whenever the request specifies
application/json
as the value for theContent-type
key in the request header.
The
rest_framework.serializers.ModelSerializer
class:Automatically populates both a set of default constraints...
You're reading from Building RESTful Python Web Services
The rest of the page is locked
You have been reading a chapter from
Building RESTful Python Web ServicesPublished in: Oct 2016Publisher: PacktISBN-13: 9781786462251
© 2016 Packt Publishing Limited All Rights Reserved