Difference between APIView class and viewsets class?

前端 未结 4 1321
死守一世寂寞
死守一世寂寞 2021-02-03 22:36

What are the difference between APIView class and viewsets class ? I am following Django REST-framework official documentation. I think it lac

4条回答
  •  悲哀的现实
    2021-02-03 23:06

    APIView allow us to define functions that match standard HTTP methods like GET, POST, PUT, PATCH, etc.

    Viewsets allow us to define functions that match to common API object actions like : LIST, CREATE, RETRIEVE, UPDATE, etc.

    Viewsets are also used to write logic to perform standard database operations and to interface with a database back-end. And are usually used for existing database model to manage predefined objects.

提交回复
热议问题