parameters: (self, object, **kwargs)
return_statement: return qs
docstring: Stream of most recent actions by objects that the passed User object is
          following.
docstring_summary: Stream of most recent actions by objects that the passed User object is
          following.
docstring_tokens: Stream of most recent actions by objects that the passed User object is following .
function: def user(self, object, **kwargs):
          """
          Stream of most recent actions by objects that the passed User object is
          following.
          """
          from actstream.models import Follow
          q = Q()
          qs = self.filter(public=True)
          actors_by_content_type = defaultdict(lambda: [])
          others_by_content_type = defaultdict(lambda: [])
  
          follow_gfks = Follow.objects.filter(user=object).values_list(
              'content_type_id', 'object_id', 'actor_only')
  
          if not follow_gfks:
              return qs.none()
  
          for content_type_id, object_id, actor_only in follow_gfks.iterator():
              actors_by_content_type[content_type_id].append(object_id)
              if not actor_only:
                  others_by_content_type[content_type_id].append(object_id)
  
          for content_type_id, object_ids in actors_by_content_type.iteritems():
              q = q | Q(
                  actor_content_type=content_type_id,
                  actor_object_id__in=object_ids,
              )
          for content_type_id, object_ids in others_by_content_type.iteritems():
              q = q | Q(
                  target_content_type=content_type_id,
                  target_object_id__in=object_ids,
              ) | Q(
                  action_object_content_type=content_type_id,
                  action_object_object_id__in=object_ids,
              )
          qs = qs.filter(q, **kwargs)
          return qs
function_tokens: def user ( self , object , * * kwargs ) : from actstream . models import Follow q = Q ( ) qs = self . filter ( public = True ) actors_by_content_type = defaultdict ( lambda : [ ] ) others_by_content_type = defaultdict ( lambda : [ ] ) follow_gfks = Follow . objects . filter ( user = object ) . values_list ( 'content_type_id' , 'object_id' , 'actor_only' ) if not follow_gfks : return qs . none ( ) for content_type_id , object_id , actor_only in follow_gfks . iterator ( ) : actors_by_content_type [ content_type_id ] . append ( object_id ) if not actor_only : others_by_content_type [ content_type_id ] . append ( object_id ) for content_type_id , object_ids in actors_by_content_type . iteritems ( ) : q = q | Q ( actor_content_type = content_type_id , actor_object_id__in = object_ids , ) for content_type_id , object_ids in others_by_content_type . iteritems ( ) : q = q | Q ( target_content_type = content_type_id , target_object_id__in = object_ids , ) | Q ( action_object_content_type = content_type_id , action_object_object_id__in = object_ids , ) qs = qs . filter ( q , * * kwargs ) return qs