title: Django model field choices - wouldn't a dict be better?
body: <p>Given a field;</p>
  
  <pre><code>domain_status_choices = (
      (1,'Live')
      (2,'Offline')
      (3,'Dev')
  )
  status = models.SmallIntegerField( choices=domain_status_choices )
  </code></pre>
  
  <p>I know I can get and set numeric representation and use <code>get_status_display()</code> to get the text label. But if a user posts <code>status=Offline</code> how can I get the numeric value in order to save it? I'd also like to be able to validate that numbers or text values are in the list.</p>
  
  <p>To me it makes more sense to use a dict. Here's my current method;</p>
  
  <pre><code>domain_status_choices = {
      1: 'Live',
      2: 'Offline',
      3: 'Dev',
  }
  status = models.SmallIntegerField( choices=domain_status_choices.iteritems() )
  ...
  if input1 not in domain_status_choices.keys(): print "invalid"
  if input2 not in domain_status_choices.items(): print "invalid"
  status = [k for k, v in domain_status_choices.iteritems() if v == input3][0]
  </code></pre>
  
  <p>Is there a better way? Why is a tuple of tuples usually used?</p>