title: Get objects with similar foreign key
body: <p>This is a basic question that probably has been asked before, but after searching quite a time, I couldn't find the answer. I'm not very familiar with the terminology in Django yet, so I've probably searched for the wrong phrases.</p>
  
  <p>To the question: I currently have 3 different models:</p>
  
  <pre><code>League
  Team (foreign key=League)
  Match(foreign key=League)
  </code></pre>
  
  <p>My goal is to add a choice list in the <code>Match</code> model where all teams which have the same primary key as the Match instance is listed. I'm not sure if I am attacking this problem the right way - the <a href="https://docs.djangoproject.com/en/dev/ref/models/fields/#choices" rel="nofollow">documentation</a> says that <code>choice</code> should be limited to static values</p>
  
  <p>Later on, I want to reference the chosen team inside the <code>Match</code> class.</p>
  
  <p>Below is the models I've written so far.</p>
  
  <pre><code>class League(models.Model):
      league_name = models.CharField(max_length=30)
      max_teams = models.IntegerField()
  
      def __unicode__(self):
          return self.league_name
  
  
  class Team(models.Model):
      league = models.ForeignKey(League)
      team_name = models.CharField(max_length=30)
  
      def __unicode__(self):
          return self.team_name
  
  
  class Match(models.Model):
      league = models.ForeignKey(League)
      teams = {team.team_name: team for team in Team.objects.filter(pk=league)}
      home_team = models.CharField(choices=teams)
  </code></pre>
  
  <p>When executing <code>python manage.py syncdb</code>, I get a pretty long traceback, but the code it questions is </p>
  
  <pre><code>teams = {team.team_name: team for team in Team.objects.filter(pk=league)}
  </code></pre>
  
  <p>Traceback:</p>
  
  <pre><code>(...)
  TypeError: int() argument must be a string or a number, not 'ForeignKey'
  </code></pre>
  
  <p>Can anyone point me in the right direction? </p>