We will write our RESTful Web Service by coding class-based views. We will take advantage of a set of generic views that we can use as our base classes for our class-based views to reduce the required code to the minimum and reuse the behavior that has been generalized in the Django REST framework.
We will create subclasses of the two following generic class views declared in the
ListCreateAPIView: This class view implements the
getmethod that retrieves a listing of a queryset and the
postmethod that creates a model instance
RetrieveUpdateDestroyAPIView: This class view implements the
patchmethods to retrieve, delete, completely update, or partially update a model instance
Those two generic views are composed by combining reusable bits of behavior in the Django REST framework implemented as mixin classes declared in the
rest_framework.mixins module. We can create a class that uses multiple inheritance and...