How to jundge the request.user is AnonymousUser in Django?
class UserListAPIView(ListAPIView):
    serializer_class = UserSerializer
    permission_classes = []
    queryset = User.objects.all()
    def get(self, request):
        if request.user:
            print("not AnonymousUser" ) # there I tried
        return Response(data="200", status=HTTP_200_OK)
You see, I tried request.user to check the user whether exist, but failed, always print the not AnonymousUser.
How to check it?
 
     
    