title: Multiple Foreign keys in DRF
body: <p>I am completely new to django and python kindly help me with below query:</p>
  <p>I have 3 models , with multiple foreign key relations with given sample data</p>
  <p>now I need 3 outputs via django ORM or Serializers</p>
  <p>1.for a given student id ,display the Student details and marks in each subjects</p>
  <p>2.list all the students with their total marks (sum of three subjects in this case)</p>
  <p>3.Average marks scored by all the students for each subject for ex as per the given sample marks in English are 65 , 95 and average is 80</p>
  <p>{ Subject :&quot;English&quot;, average : &quot; 80&quot;
  }</p>
  <pre><code>class Student(models.Model):
          student_id = ShortUUIDField(primary_key=True, editable=False)
          first_name = models.CharField(max_length=50)
          last_name  = models.CharField(max_length=50)
  
  class Subjects(models.Model):
      subject_code = ShortUUIDField(primary_key=True, editable=False)
      subject_name = models.CharField(max_length=100)
  
  class Reports(models.Model):
      student = models.ForeignKey(Student,on_delete=models.CASCADE,related_name='student_report')
      subject = models.ForeignKey(Subjects,on_delete=models.CASCADE,related_name='subject',default=None)
      marks   = models.IntegerField(max_length='3')
  class Meta:
      unique_together = (&quot;student&quot;, &quot;subject&quot;)
  </code></pre>
  <p>sample data</p>
  <pre><code>Student data
  
  student_id  first_name  last_name
    1            abc        x
    2            def        y
   
  
  
  Subjects data
  
  subject_code  subject_name
      1          English
      2          Science
      3          Math
  
  
  Reports data
  
   student_id  subject_id  marks 
       1          1         65
       1          2         75
       1          3         92
       2          1         95
       2          2         85
       2          3         62
  </code></pre>