(self, user, instance)
return queryset.filter(user=user).exists()
Check if a user is following an instance.
Check if a user is following an instance.
Check if a user is following an instance .
def is_following(self, user, instance):
        """
        Check if a user is following an instance.
        """
        if not user or user.is_anonymous():
            return False
        queryset = self.for_object(instance)
        return queryset.filter(user=user).exists()
def is_following ( self , user , instance ) : if not user or user . is_anonymous ( ) : return False queryset = self . for_object ( instance ) return queryset . filter ( user = user ) . exists ( )