title: How to modify choices on Django Admin
body: <p>I have a model that has a field named "state":</p>
  
  <pre><code>class Foo(models.Model):
      ...
      state = models.IntegerField(choices = STATES)
      ...
  </code></pre>
  
  <p>For every state, possible choices are a certain subset of all STATES. For example:</p>
  
  <pre><code>if foo.state == STATES.OPEN:     #if foo is open, possible states are CLOSED, CANCELED
      ...
  if foo.state == STATES.PENDING:  #if foo is pending, possible states are OPEN,CANCELED
      ...
  </code></pre>
  
  <p>As a result, when foo.state changes to a new state, its set of possible choices changes also.</p>
  
  <p>How can I implement this functionality on Admin add/change pages?</p>