filmov
tv
Django REST API Tutorial - Guide to Viewsets, Routers and Serializers - Django RestFramework

Показать описание
ViewSets:
ViewSet is a type of class-based view.
Instead of method handlers, like .get() and .post(), it provides actions, like .list() and .create().
The most significant advantage of ViewSets is that the URL construction is handled automatically (with a router class). This helps with the consistency of the URL conventions across your API and minimizes the amount of code you need to write.
There are four types of ViewSets, from the most basic to the most powerful:
ViewSet
GenericViewSet
ReadOnlyModelViewSet
ModelViewSet
They're mostly built out of the classes you got to know in the previous article in this series:
Official Django REST Framework Tutorial - A Beginners Guide:
This is a beginner-friendly guide to the official Django Rest Framework tutorial. If you have struggled to complete the official tutorial on your own, consider this guide a good place to start instead.
The final code is exactly the same and is available on Github. However I provide more detailed explanations of each step, use the Django admin rather than the Django shell for populating the models, emphasize class-based views over function-based views, and so on.
After completing this tutorial, the official tutorial should make a lot more sense and help you take full advantage of the awesomeness that is Django REST Framework.
NOTE: If you'd like to learn even more about APIs in Django, I've written an entire book on the subject, Django for APIs. The first few chapters are available for free.
Initial Setup
Once that's done, create a dedicated directory for our code. This can live anywhere on your computer but in a location that is easily accessible. One option, if you're on a Mac computer, is to create a drf directory on your Desktop. That's what we'll do here.
Enter the following commands in your terminal:
Hashtags:
Django Rest Framework Series - Viewsets and Routers with React Front-end Example - Part-4
Django REST framework: Concepts behind different types of routers and viewsets?
Django REST API Tutorial - Guide to Viewsets, Routers and Serializers #2 (2018)
Django Rest Framework Tutorial.| Viewsets, Routers, Serializers, and CRUD
Learn Django REST Framework #6 Viewsets And Routers
9 | ModelViewSet and Routers in Django Rest Framework | By Hardik Patel
ViewSet in Django REST Framework (Hindi)
ViewSets in Django Rest Framework and Types #100
Hashtags:
#restapi #python #javascript #api #programming #programmer #coding #webdevelopment #developer #html #reactjs #java #technology #css #webdeveloper #php #webdev #http #computerscience #computer #database #nodejs #mysql #json #devops #csharp #tech #software #graphql #vuejs #github #networkautomation #machinelearning #devnet #django #developers
ViewSet is a type of class-based view.
Instead of method handlers, like .get() and .post(), it provides actions, like .list() and .create().
The most significant advantage of ViewSets is that the URL construction is handled automatically (with a router class). This helps with the consistency of the URL conventions across your API and minimizes the amount of code you need to write.
There are four types of ViewSets, from the most basic to the most powerful:
ViewSet
GenericViewSet
ReadOnlyModelViewSet
ModelViewSet
They're mostly built out of the classes you got to know in the previous article in this series:
Official Django REST Framework Tutorial - A Beginners Guide:
This is a beginner-friendly guide to the official Django Rest Framework tutorial. If you have struggled to complete the official tutorial on your own, consider this guide a good place to start instead.
The final code is exactly the same and is available on Github. However I provide more detailed explanations of each step, use the Django admin rather than the Django shell for populating the models, emphasize class-based views over function-based views, and so on.
After completing this tutorial, the official tutorial should make a lot more sense and help you take full advantage of the awesomeness that is Django REST Framework.
NOTE: If you'd like to learn even more about APIs in Django, I've written an entire book on the subject, Django for APIs. The first few chapters are available for free.
Initial Setup
Once that's done, create a dedicated directory for our code. This can live anywhere on your computer but in a location that is easily accessible. One option, if you're on a Mac computer, is to create a drf directory on your Desktop. That's what we'll do here.
Enter the following commands in your terminal:
Hashtags:
Django Rest Framework Series - Viewsets and Routers with React Front-end Example - Part-4
Django REST framework: Concepts behind different types of routers and viewsets?
Django REST API Tutorial - Guide to Viewsets, Routers and Serializers #2 (2018)
Django Rest Framework Tutorial.| Viewsets, Routers, Serializers, and CRUD
Learn Django REST Framework #6 Viewsets And Routers
9 | ModelViewSet and Routers in Django Rest Framework | By Hardik Patel
ViewSet in Django REST Framework (Hindi)
ViewSets in Django Rest Framework and Types #100
Hashtags:
#restapi #python #javascript #api #programming #programmer #coding #webdevelopment #developer #html #reactjs #java #technology #css #webdeveloper #php #webdev #http #computerscience #computer #database #nodejs #mysql #json #devops #csharp #tech #software #graphql #vuejs #github #networkautomation #machinelearning #devnet #django #developers