title: How to get ForeignKey value for specific field in Django view
body: <p>I have two models defined in my models.py:</p>
  
  <pre><code>class model1(models.Model):
      name = models.CharField(max_length=100, unique=True)
      desc = models.CharField(max_length=1000, blank=True, null=True)
  
      def __unicode__(self):
          return u'ID: %s, name - %s, description - %s' % (str(self.pk), self.name, self.desc)
  
  class model2(models.Model):
      description = models.CharField(max_length=500, blank=True, null=True)
      repo_id = models.ForeignKey(model1, to_field='id', db_column="repo_id", null=False)
      content = models.TextField(blank=True)
  
      def __unicode__(self):
          return u'ID: %s, rpt_repo_id - %s, created_date - %s' % (str(self.pk), str(self.repo_id.pk), self.created_date)
  </code></pre>
  
  <p>I want to query from model2 to fetch name from model1 where id(pk) of model1 is value from rpt_repo_id of model2. Below query doesn't work here:</p>
  
  <pre><code>saved_reports = models.model2.objects.all()
  </code></pre>
  
  <p>Although <code>{{ repo_id.name }}</code> works fine in html.</p>