Django Rest Framework ViewSets ViewSets - Django REST framework In Django REST framework, a ViewSet is a class that defines the actions that can be performed on a particular model or resource. A ViewSet is typically paired with a Router , which maps the HTTP methods and URL patterns to the appropriate ViewSet actions. Django REST framework provides several built-in ViewSet classes, including: ViewSet : A base class for all other ViewSet classes. It provides a basic implementation for handling requests and responses, and can be subclassed to create your own ViewSet classes. ModelViewSet : A ViewSet for working with a model and its related serializer. It provides the default implementation for the following actions: list , create , retrieve , update , and destroy . ReadOnlyModelViewSet : A ViewSet that provides read-only actions for a model and its related serializer. It provides the default implementation for the following actions: list and retrieve . GenericViewSet : A...
Blog contains latest technology updates, interview experiences, languages and frameworks, problems and codes etc.