コード例 #1
0
 def post(self, request):
     serializer = LoginSerializer(data=request.data, context={
         'request': request,
     })
     serializer.is_valid(raise_exception=True)
     serializer.save()
     return response.Response(
         status=status.HTTP_200_OK,
         data={
              'details': 'You have been logged in successfully!'
         },
     )
コード例 #2
0
    def post(self, request):

        login_serializer = LoginSerializer(data=request.data,
                                           context={
                                               'request': request,
                                           })
        login_serializer.is_valid(raise_exception=True)
        login_serializer.save()

        return response.Response(status=status.HTTP_200_OK,
                                 data={
                                     'message': 'Login successfully.',
                                 })