title: DRF get current user details
body: <p>I want to get the current logged in user's details:</p>
  
  <p><strong>views.py</strong></p>
  
  <pre><code>class UserData(APIView):
      permission_classes = (IsAuthenticatedOrReadOnly,)
  
      def get(self, request):
          serializer = UserSerializer(self.request.user)
          return Response(serializer.data)
  </code></pre>
  
  <p>serializers.py</p>
  
  <pre><code>class UserSerializer(serializers.ModelSerializer):
  
      class Meta:
          model = CustomUser
          fields = ['id', 'email', 'valid_email', 'nickname', 'name', 'date_of_birth', 'city', 'country', 'date_joined']
  </code></pre>
  
  <p>When i'm trying to access the url i get this error: </p>
  
  <pre><code>AttributeError at /core/user-data/  
  Got AttributeError when attempting to get a value for field `email` on serializer `UserSerializer`. 
  The serializer field might be named incorrectly and not match any attribute or key on the `AnonymousUser` instance. 
  Original exception text was: 'AnonymousUser' object has no attribute 'email'.
  </code></pre>
  
  <p>The thing is that i am logged in. What could cause the error?</p>