Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Additional Information: Built-in Views | Views and Routers
Django REST Framework
course content

Contenido del Curso

Django REST Framework

Django REST Framework

1. What is the Rest API ?
2. What is Serialization?
3. Views and Routers
4. HTTP Request Methods

bookAdditional Information: Built-in Views

In Django REST Framework, built-in views are like tools that help create parts of an API. They allow your web application to receive requests from users and send them responses. For example, when you visit a webpage or use a mobile app and click buttons, those actions generate requests. Built-in views in DRF help process these requests and send responses back to users.

During the course, we will be using ModelViewSet, but it's worth knowing about its alternatives.

  1. APIView: This is the base class for creating your own views. You can define the logic for handling HTTP requests (GET, POST, PUT, DELETE, etc.) in methods of the class such as get(), post(), put(), delete();
  2. GenericAPIView: This class provides additional conveniences for working with Django models, including support for CRUD operations (create, read, update, delete). It combines the functionality of APIView with features that facilitate working with models, such as serializers, querysets, etc;
  3. ViewSet: This class provides a way to organize views for different types of requests at the resource level. For example, you can have methods for handling GET, POST, PUT, DELETE requests for a single resource (e.g., /api/users/). ViewSet simplifies code organization, as you can describe all related methods for one resource in one class;
  4. ReadOnlyModelViewSet: This is a subclass of ModelViewSet that allows only reading data. It automatically generates methods for handling GET requests but does not allow modifying data.

By using these built-in views, you can quickly create an API with minimal code. DRF also provides many options for customizing and extending these built-in views, allowing you to create complex APIs according to your needs.

1. What kind of requests can you handle using APIView?
2. What is the purpose of ReadOnlyModelViewSet?
What kind of requests can you handle using APIView?

What kind of requests can you handle using APIView?

Selecciona la respuesta correcta

What is the purpose of ReadOnlyModelViewSet?

What is the purpose of ReadOnlyModelViewSet?

Selecciona la respuesta correcta

¿Todo estuvo claro?

¿Cómo podemos mejorarlo?

¡Gracias por tus comentarios!

Sección 3. Capítulo 3
some-alt