Complete the code to import the generic ListAPIView from Django REST Framework.
from rest_framework import [1]
The generics module contains the generic views like ListAPIView.
Complete the code to create a ListAPIView for a model named Book.
class BookListView([1]): queryset = Book.objects.all() serializer_class = BookSerializer
ListAPIView is the generic view to list objects in DRF.
Fix the error in the code by completing the missing generic view class to retrieve and update a single Book instance.
class BookDetailView([1]): queryset = Book.objects.all() serializer_class = BookSerializer
RetrieveUpdateAPIView allows retrieving and updating a single object.
Fill both blanks to create a generic view that supports listing and creating Book objects.
class BookListCreateView([1], [2], GenericAPIView): queryset = Book.objects.all() serializer_class = BookSerializer
Combining ListModelMixin and CreateModelMixin with GenericAPIView enables listing and creating.
Fill all three blanks to define a generic view that supports retrieve, update, and destroy actions for Book.
class BookDetailView([1], [2], [3], GenericAPIView): queryset = Book.objects.all() serializer_class = BookSerializer
Using RetrieveModelMixin, UpdateModelMixin, and DestroyModelMixin together with GenericAPIView supports retrieve, update, and delete.