title: Durationfield django
body: <p>Difficulty using the new DurationField in Django 1.8 </p>
  
  <p>I'm having a bit of trouble with Django's new <a href="https://docs.djangoproject.com/en/1.8/ref/models/fields/#django.db.models.DurationField">DurationField</a> for models.</p>
  
  <p>I want the user to be able to choose if the duration of an event on my webapp is 1 day, 3 days, or 5 days, with the default choice being 3 days.</p>
  
  <p>At the beginning of my model, I declare the choices:</p>
  
  <pre><code>SHORT = datetime.timedelta(days=1)
  MEDIUM = datetime.timedelta(days=3)
  LONG = datetime.timedelta(days=5)
  DURATION_CHOICES = ((SHORT, '1 day'),(MEDIUM, '3 days'), (LONG, '5 days'),)
  </code></pre>
  
  <p>Then below, I declare the DurationField:</p>
  
  <pre><code>duration = models.DurationField(choices = DURATION_CHOICES, default = MEDIUM)
  </code></pre>
  
  <p>I created a ModelForm for the model, and rendered it on the appropriate template. On the form, "3 days" was the preselected choice in the dropdown, and "1 day" and "5 days" are options as well. However, when I submit the form, I get the form validation error "Select a valid choice. 3 days, 0:00:00 is not one of the available choices."</p>
  
  <p>However, when I remove the choices from DurationField and leave the default:</p>
  
  <pre><code>duration = models.DurationField(default = MEDIUM)
  </code></pre>
  
  <p>I can submit without any issues. What am I doing wrong here?</p>