title: Limit/Filter Foreign Key Choices in Django Admin
body: <p>Consider an app where people can participate in a contest. </p>
  
  <p>I have a <code>Contest</code> and <code>ContestProblem</code> Model ready. I want to have following features for the contest:</p>
  
  <ol>
  <li>A contest can have many problems</li>
  <li><strong>A problem can not appear in more than one contest</strong></li>
  </ol>
  
  <p>In my <code>models.py</code>, I have:</p>
  
  <pre><code>class ProblemsInContest(CreateUpdateDateModel):
      contest = models.ForeignKey(Contest)
      problem = models.ForeignKey(ContestProblem)
  
      class Meta:
          verbose_name = "Problem in Contest"
          verbose_name_plural = "Problems in Contest"
  
      def __str__(self):
          return "{problem}".format(problem=self.problem)
  </code></pre>
  
  <p>In my admin.py, I have:</p>
  
  <pre><code>class ContestProblemInline(admin.TabularInline):
      model = ProblemsInContest
      extra = 1
  
  
  class ContestAdmin(admin.ModelAdmin):
  
      inlines = [
          ContestProblemInline,
      ]
  </code></pre>
  
  <p>This is how my Admin Form look:
  <a href="https://i.stack.imgur.com/b4DiW.png" rel="noreferrer"><img src="https://i.stack.imgur.com/b4DiW.png" alt="enter image description here"></a></p>
  
  <p>I am using Django Admin to add problems to a contest. The problem being the fact that in the Problem dropdown, it shows me all the <code>ContestProblem</code> but I want to limit it to only those <code>ContestProblem</code> which does not appear in any other contest.</p>
  
  <p>Any hints or advice or references to achieve the desired results will be highly appreciated.</p>