title: DRF Object of type 'User' is not JSON serializable
body: <p>I'm trying to return the details of the current logged in user in the following way:</p>
  
  <pre><code>from .serializers import UserSerializer
  
  class UserDetailsView(RetrieveAPIView):                                                                                                                                                                           
      model = User                                                                                                                                                                                                  
      queryset = User.objects.all()                                                                                                                                                                                 
      permission_classes = [permissions.IsAuthenticated]                                                                                                                                                            
      serializer_class = UserSerializer                                                                                                                                                                             
  
      def get(self, request, *args, **kwargs):                                                                                                                                                                      
          user = User.objects.get(id=request.user.id)                                                                                                                                                               
          print(user)                                                                                                                                                                                               
          return Response(user)
  </code></pre>
  
  <p>in serializers.py I've use <code>ModelSerializer</code></p>
  
  <pre><code>class UserSerializer(serializers.ModelSerializer):                                                                                                                                                                
        password = serializers.CharField(write_only=True)                                                                                                                                                             
  
        def create(self, validated_data):                                                                                                                                                                             
            user = UserModel.objects.create(username=validated_data['username'])                                                                                                                                      
            user.set_password(validated_data['password'])                                                                                                                                                             
            user.save()                                                                                                                                                                                               
            return user                                                                                                                                                                                               
  
        class Meta:                                                                                                                                                                                                   
            model = UserModel                                                                                                                                                                                         
            fields = ('id', 'username', 'password')                                                                                                                                                                   
            write_only_fields = ('password',)
  </code></pre>
  
  <p>I get an error <code>Object of type 'User' is not JSON serializable</code>. What is wrong in my use case?</p>