title: How to write query with multiple models in Django
body: <p>How to write a query for student who logged in(<code>student = self.request.user.id</code>) to view his assignments titles (belong to his 
  intake)</p>
  
  <pre><code>    class intake(models.Model):
      intakecode = models.CharField(max_length=100)
      modules = models.ManyToManyField(Module, through='IntakeDetails')
  
      class Student(models.Model):
      user = models.OneToOneField(UserType, on_delete=models.CASCADE, 
      primary_key=True)
      intakecode = models.ForeignKey(intake, on_delete=models.CASCADE)
  </code></pre>
  
  <p>student belong to a intake and each intake many modules.</p>
  
  <pre><code>    class IntakeDetails(models.Model):
      intake = models.ForeignKey(intake, on_delete=models.CASCADE)
      lecturer = models.ForeignKey(Lecturer, on_delete=models.CASCADE)
       module= models.ForeignKey(Module, on_delete=models.CASCADE)
  
      class AssignAssignment(models.Model):
      title=models.CharField(max_length=30)
      duedate=models.DateField()
  intakedetails=models.ForeignKey(IntakeDetails,on_delete=models.CASCADE,null=True)
  </code></pre>
  
  <p>I tried this one but if there are more than one <code>intakedetails</code>, however, it pops up an error.</p>
  
  <pre><code>@login_required
  class ModelIndexView(ListView):
  template_name= 'accounts/students/students.html'
  context_object_name= 'students'
  def get_queryset(self):
      student = self.request.user.id
      student_det = Student.objects.get(user_id=student)
      assignment=IntakeDetails.objects.get(intake_id=student_det.intakecode)
      queryset=AssignAssignment.objects.filter(intakedetails_id=assignment.id)
      return queryset
  </code></pre>