old_contents: from rest_framework.views import APIView
  from rest_framework import status
  from rest_framework import parsers
  from rest_framework import renderers
  from rest_framework.response import Response
  
  from rest_framework_jwt.settings import api_settings
  
  from .serializers import JSONWebTokenSerializer, RefreshJSONWebTokenSerializer
  
  jwt_response_payload_handler = api_settings.JWT_RESPONSE_PAYLOAD_HANDLER
  
  
  class ObtainJSONWebToken(APIView):
      """
      API View that receives a POST with a user's username and password.
  
      Returns a JSON Web Token that can be used for authenticated requests.
      """
      throttle_classes = ()
      permission_classes = ()
      authentication_classes = ()
      parser_classes = (parsers.FormParser, parsers.JSONParser,)
      renderer_classes = (renderers.JSONRenderer,)
      serializer_class = JSONWebTokenSerializer
  
      def post(self, request):
          serializer = self.serializer_class(data=request.DATA)
  
          if serializer.is_valid():
              user = serializer.object.get('user') or request.user
              token = serializer.object.get('token')
              response_data = jwt_response_payload_handler(token, user)
  
              return Response(response_data)
  
          return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST)
  
  
  class RefreshJSONWebToken(APIView):
      """
      API View that returns a refreshed token (with new expiration) based on
      existing token
  
      If 'orig_iat' field (original issued-at-time) is found, will first check
      if it's within expiration window, then copy it to the new token
      """
      throttle_classes = ()
      permission_classes = ()
      authentication_classes = ()
      parser_classes = (parsers.FormParser, parsers.JSONParser,)
      renderer_classes = (renderers.JSONRenderer,)
      serializer_class = RefreshJSONWebTokenSerializer
  
      def post(self, request):
          serializer = self.serializer_class(data=request.DATA)
  
          if serializer.is_valid():
              user = serializer.object.get('user') or request.user
              token = serializer.object.get('token')
              response_data = jwt_response_payload_handler(token, user)
  
              return Response(response_data)
  
          return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST)
  
  
  obtain_jwt_token = ObtainJSONWebToken.as_view()
  refresh_jwt_token = RefreshJSONWebToken.as_view()
  
new_contents: from rest_framework.views import APIView
  from rest_framework import status
  from rest_framework import parsers
  from rest_framework import renderers
  from rest_framework.response import Response
  
  from rest_framework_jwt.settings import api_settings
  
  from .serializers import JSONWebTokenSerializer, RefreshJSONWebTokenSerializer
  
  jwt_response_payload_handler = api_settings.JWT_RESPONSE_PAYLOAD_HANDLER
  
  
  class ObtainJSONWebToken(APIView):
      """
      API View that receives a POST with a user's username and password.
  
      Returns a JSON Web Token that can be used for authenticated requests.
      """
      throttle_classes = ()
      permission_classes = ()
      authentication_classes = ()
      parser_classes = (parsers.FormParser, parsers.JSONParser,)
      renderer_classes = (renderers.JSONRenderer,)
      serializer_class = JSONWebTokenSerializer
  
      def post(self, request):
          serializer = self.serializer_class(data=request.DATA)
  
          if serializer.is_valid():
              user = serializer.object.get('user') or request.user
              token = serializer.object.get('token')
              response_data = jwt_response_payload_handler(token, user, request)
  
              return Response(response_data)
  
          return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST)
  
  
  class RefreshJSONWebToken(APIView):
      """
      API View that returns a refreshed token (with new expiration) based on
      existing token
  
      If 'orig_iat' field (original issued-at-time) is found, will first check
      if it's within expiration window, then copy it to the new token
      """
      throttle_classes = ()
      permission_classes = ()
      authentication_classes = ()
      parser_classes = (parsers.FormParser, parsers.JSONParser,)
      renderer_classes = (renderers.JSONRenderer,)
      serializer_class = RefreshJSONWebTokenSerializer
  
      def post(self, request):
          serializer = self.serializer_class(data=request.DATA)
  
          if serializer.is_valid():
              user = serializer.object.get('user') or request.user
              token = serializer.object.get('token')
              response_data = jwt_response_payload_handler(token, user, request)
  
              return Response(response_data)
  
          return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST)
  
  
  obtain_jwt_token = ObtainJSONWebToken.as_view()
  refresh_jwt_token = RefreshJSONWebToken.as_view()
  
subject: Support HyperlinkedModelSerializer