Django REST
About Lesson

In this Django REST Framework we are going to learn Django REST Framework API View Decorator, you can use decorators with function api based view, for example you can use api_view(), the core of this functionality is the api_view decorator, which takes a list of HTTP methods that your view should respond to. also using this decorator you can access to django browsable api view.

 

 

Now we are going to change views.py functions like this.

 

 

 

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.

Django REST Framework API View Decorator
Django REST Framework API View Decorator

 

Thank you for visiting my website! If you enjoyed the free courses, please consider supporting my works on Patreon.
Exercise Files
No Attachment Found
No Attachment Found