title: How to return all the intere connected multiple items from a Django model using a query set?
body: <p>I have a data like shown below, first column protein IDs second column peptide sequence and third column some value I have created a Django model to store this data.  </p>
  
  <p>Data table:</p>
  
  <pre><code>A0A075B6K4  YELTQPPSVSTAR   60,10
  A0A075B6K4  SYELTQPPSVTAR   2
  A0A075B6Q5  EVQLVESGEGSLR   7
  A0A075B6S5  DIQMTQSPSGDR    10
  A0A0A0MRZ8  EIVLTQSPGER 30,20
  A0A0B4J1V0  EVQLVESGGSLR    10
  A0A0B4J1X5  EVQLVESGGSLR    0
  A0A0B4J2D9  AIQLTQSPSGDR    0
  A0A0C4DH42  EVQLVESGGSLR    0
  A0A0C4DH55  EIVMTQSPGER 10
  A0A0C4DH42  YELTQPPSTAR 20
  A0A0C4DH55  YELTQPPSTAR 4
  A0A0B4J1X5  YELTQPPSTAR 12
  </code></pre>
  
  <p>Django models:</p>
  
  <pre><code>from django.db import models
  
  # Create your models here.
  
  
  class ProteinID(models.Model):
      ProtID = models.CharField(max_length=30)
  
      def __str__(self):
          return "%s" % (self.ProtID)
  
  class PeptideSeq(models.Model):
      sequence = models.CharField(max_length=100)
      feq = models.CharField(max_length=100)
      protein = models.ForeignKey(ProteinID, on_delete=models.CASCADE)
  
      def __str__(self):
          return "%s %s" % (self.sequence, self.feq)
  
      class Meta:
          ordering = ['sequence']
  </code></pre>
  
  <p><strong>Details:</strong> </p>
  
  <p>As we can see in the table a single protein ID can hold more then one peptide sequence and single peptide can be associated with more then one protein ID. </p>
  
  <p>I want to add two search option:</p>
  
  <ol>
  <li>if a protein ID entered as a query it should return all the associated peptides and the values from the third column </li>
  </ol>
  
  <p>Query A0A0C4DH55 should return</p>
  
  <pre><code>YELTQPPSTAR 4
  EIVMTQSPGER 10
  </code></pre>
  
  <ol start="2">
  <li>Or a peptide sequence entered as a query it should return all the associated protein id and values from the third column. </li>
  </ol>
  
  <p>Query EVQLVESGGSLR should return</p>
  
  <pre><code>A0A0B4J1V0 10
  A0A0B4J1X5 0
  A0A0C4DH42 0
  </code></pre>
  
  <p>How to I implement this?</p>
  
  <p>Thanks </p>