title: Why is request object not the same between a "native" view and a ModelViewSet?
body: <p>I am building an API with Django Rest Framework (DRF) and enabled the authentication/registration through social apps.</p>
  
  <p>For authenticating users via their social accounts I use Django rest-framework Social Oauth2 and it works like a charm. To be sure my user is logged in I created a very simple view in the views.py of my app:</p>
  
  <pre><code>def index(request):
      return HttpResponse("is_anonymous: %s" % request.user.is_anonymous)
  </code></pre>
  
  <p>The result in the browser is the following (it means that the user is logged in):</p>
  
  <blockquote>
    <p>is_anonymous: False</p>
  </blockquote>
  
  <p>Now as I am building an API with DRF I may need to retrieve some data of the current user (from request.user) in one of my viewsets but in the following code, the result is not what I expected:</p>
  
  <pre><code>class HelloViewSet(viewsets.ModelViewSet):
      queryset = Hello.objects.all()
      serializer_class = HelloSerializer
  
      # This is just a random ViewSet, what is
      # important is the custom view below
  
      @action(detail=False)
      def test(self, request):
          return Response(request.user.is_anonymous)
  </code></pre>
  
  <p>Here the result shows that the user not logged in:</p>
  
  <blockquote>
    <p>True</p>
  </blockquote>
  
  <p>So the first view shows that request.user.is_anonymous = False and the second shows that request.user.is_anonymous = True. Both views are in the same file views.py in the same app.</p>
  
  <p>What do I miss here? We are not supposed to get the user instance in an API REST?</p>