[Django_Rest_Framework] Views and Viewsets

rest_framework.views

  1. rest_framework.views inherit from django.views
  2. rest_framework.views.APIView inherit from django.views.generic.View
  3. rest_framework.generics.GenericAPIView inherit from APIView

rest_framework.viewsets

  1. rest_framework.viewsets.GenericViewSet inherit from GenericAPIView
  2. rest_framework.viewsets.ModelViewSet inherit from GenericViewSet

APIView

views.py

urls.py

GenericAPIView

views.py

urls.py

ModelViewSet

models.py

serializers.py

views.py

urls.py

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store