Django REST
About Lesson

In this Django REST Framework lesson we are going to learn about Django REST Framework Class API View,  till now we have learned some basics on django rest framework, and we have created some examples on functions based api view.  now it is time to talk about class based api view in django. REST framework provides an APIView class, which subclasses Django’s  View class. Using  APIView class is pretty much the same as using a regular View class, as usual, the incoming request is dispatched to an appropriate handler method such as .get() or .post(). Additionally, a number of attributes may be set on the class that control various aspects of the API policy.




OK now we are going to bring some changes in our file again, i have removed all of the codes from the, because by using class based api view i don’t need that code.




Also you need to bring changes in your file , because now we are using class based views.




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 class based api view.

Django REST Framework Class API View
Django REST Framework Class API View