title: Retrieving multiple rows from seperate model in django relationships
body: <p>I've been struggling with this puzzled for a few hours. Here's a schema of what I'm trying to do.</p>
  <p><a href="https://i.stack.imgur.com/BbcXB.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/BbcXB.png" alt="enter image description here" /></a></p>
  <p>I have a user model and a profile model, it's a one-to-one relationship, but I'd like to be able to query a user and retrieve all the email addresses (from the User model) for users that share the same company (from the Profile Model). To be fair, my understanding of django is limited, but I went through the <a href="https://www.django-rest-framework.org/api-guide/relations/" rel="nofollow noreferrer">serializer relations</a> guide and tried my hands at most approach described there, to no avail. At this point, I'm not even sure I'm on the right path.</p>
  <p>So, my understanding of it is</p>
  <ol>
  <li>From the user, I need to fetch the profile (a <code>source='profile'</code> approach may work)</li>
  <li>From that profile, I need to retrieve the company</li>
  <li>From that company, I need to retrieve all the user_id that belongs to that company</li>
  <li>From those user_ids, I need to lookup the email fields of all those users</li>
  <li>I need to also filter out the email address of the user making the request</li>
  </ol>
  <p>Does this make any sense? At this point, I'm trying to accomplish all of that from the serializer, but was unsuccessful. Here are some snippets of code I tried, but I doubt any of them will point towards any form of solution, unfortunately.</p>
  <pre><code>class TeamEmailsSerializer(serializers.ModelSerializer):
      class Meta:
          model = User
          fields = ['email']
  
  class UserSerializer(serializers.ModelSerializer):
  
      ...
  
      # only one of them was present at a time, but none gave any promising results
  
      test_one = Profile.objects.filter(source=profile.company.id).values_list('user_id', flat=True)
  
      test_one = serializers.RelatedField(source='profile.company.id', read_only=True)
  
      test_one = TeamEmailsSerializer(many=True, read_only=True)
  
      test_one = serializers.PrimaryKeyRelatedField(source='email', queryset=User.objects.filter())
  
      class Meta:
          model = User
          fields = (
              'test_one'
          ) 
  </code></pre>
  <p>I'm grateful for any clue that may lead towards a solution.</p>