APIView is the most basic class that you usually override when defining a REST view. You usually define your methods such as get, put, delete, and others check ( http://www.cdrf.co/3.5/rest_framework.views/APIView.html ). With APIView, you define your view and add it to your URLs as follows:
#in views.py class MyAPIView(APIView): ...
Since some things, such as receiving / post / 4, deleting / post / 4, receiving all messages, updating and creating a new publication, were so common that DRF provides Viewsets.
But before you learn โViewsetsโ, let me tell you that there are also general classes, that they do it very well, but you need to provide a complete API endpoint, as in my MyAPIView view (again for additional verification of http information : //www.cdrf.co/ or http://www.django-rest-framework.org/ ). Therefore, you will need to define your own URL path.
But with ViewSets, you create a viewset that actually combines all the operations described above, and you donโt need to specify the URL that you usually use for the router that creates the paths for you:
#views.py class PostViewSet(ViewSet):
source share