title: Django Templates: Accessing FK methods
body: <p>Good Afternoon,</p>
  
  <p>I'd like to be able to display a returned value from a method that is in a foreign table (the template obj shares a one-many relationship):</p>
  
  <pre><code>models.py
  
  class teacher(stuff):
      name = models.charfield()
      website = models.URLField()
      slug = models.SlugField(max_length=255, db_index=True, unique=True)
  
      def get_page_url(self):
          return reverse('teacher_page', args=[self.slug])
  
  
  class homework(stuff):
      assignment = models.ForeignKey(teacher)
      due_date = models.DateField()
      other assignment stuff..
  </code></pre>
  
  <p>I pass the assignment object into my template, and can access it's attributes like so:</p>
  
  <pre><code>{{homework.due_date}}
  </code></pre>
  
  <p>but let us say I want to display the page of the teacher who has assigned the homework. I thought I should be able to access it like so:</p>
  
  <pre><code>&lt;a href='{{homework.teacher_set.get_page_url}}'&gt;teacher page&lt;/a&gt;
  </code></pre>
  
  <p>But this just results in an attribute error.</p>
  
  <p>How can I get the url?</p>
  
  <p>NOTE: This example was written on the fly for the purpose of conveying the question only. No syntax trolls!</p>