QuerySet doesn't filter by user

Here's the new get_query which fixed the issue:

def get_queryset(self):
    user = self.request.user
    if user.is_anonymous:
        return rat.objects.all()
    return rat.objects.filter(user=user.id)

Basically I get the user first, and I filter by user.id. Earlier I tried to get the userId immediately and filter by that.

Another change I did was add ModelViewSet to the viewset, but I don't think that made a difference(?)

Edit: the if user.is_anonymous part just makes it so that the user sees all objects if they're not logged in. This is just for testing purposes