Django REST
About Lesson

In this Django REST Framework lesson we are going to learn about Django REST Framework Model Viewset, rather than writing your own viewsets, you’ll often want to use the existing base classes that provide a default set of behavior. for this we are using model viewset. the ModelViewSet class inherits from GenericAPIView and includes implementations for various actions, by mixing in the behavior of the various mixin classes. the actions provided by the ModelViewSet class  are .list(), .retrieve(), .create(), .update(), .partial_update(), and .destroy().




Open your file and bring changes, this time we want to use model viewset.





If you go to http://localhost:8000/articles/  you can see a browsable api from the django rest framework with same functionality of posting article, getting article, retrieving article, deleting article and updating article, but this time we have used model viewsets.

Django REST Framework Model Viewset
Django REST Framework Model Viewset