Django REST
About Lesson

In this Django REST Framework we are going to learn about Django REST Framework Generic Viewsets, this is another type of viewsets that we can use, basically The GenericViewSet class inherits from GenericAPIView, and provides the default set  of get_object, get_queryset methods and other generic view base behavior, but does not include any actions by default. In order to use a GenericViewSet class you’ll override the class and either mixin the required mixin classes, or define the action implementations explicitly.

 

 

 

Now open your views.py and add this cod, this time we are going to use Generic Viewsets instead of Viewset.

 

 

 

And this is our urls.py file.

 

 

 

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 generic viewsets.

Django REST Framework Generic Viewsets
Django REST Framework Generic Viewsets