title: Datetime values in Django forms (initial and submitted has different format thought)
body: <p>For some reason I use a custom HTML-code for displaying the form. My form's input get the initial value (date), and shows the same form after submittion.</p>
  
  <p>But after submit, input has no previously selected value (just empty).</p>
  
  <p>I use <code>{{ Form.Fileld.value|date:"Y-m-d" }}</code> in the temlate to get initial and submitted values.</p>
  
  <p>It seems that initial and submitted values are in different formats: "datetime" for initial values and "string" after submit.</p>
  
  <p>Here is my simple test:</p>
  
  <p><strong>Form</strong></p>
  
  <pre><code>class ShowStartEndDateForm(forms.Form):
      start_date = forms.DateField(initial=date.today().replace(day=1), 
          label="Start", 
          widget=forms.DateInput(format='%Y-%m-%d'), 
          input_formats=['%Y-%m-%d'])
      ...
  </code></pre>
  
  <p><strong>View</strong></p>
  
  <pre><code>if request.method == 'POST':
      form_date = ShowStartEndDateForm(request.POST)
  
      if form_date.is_valid():
          form_was_submitted = True
          cd = form_date.cleaned_data
          operator = cd['operators']
  
          days=[]
          for day in range(0,(cd['end_date']-cd['start_date']).days+1):
              days.append(cd['start_date']+relativedelta(days=+day))
  
  else:
      form_date = ShowStartEndDateForm()
  
  return render_to_response('epay.html', locals(),
      context_instance=RequestContext(request))
  </code></pre>
  
  <p><strong>Template</strong></p>
  
  <pre><code>&lt;!- HTML FORM here 
  |classname is my custom template filter.
  --&gt;
  Date1: {{ form_date.start_date.value|date:"Y-m-d" }} \
  ({{ form_date.start_date.value|classname }})
  Date2: {{ form_date.start_date.value }}
  </code></pre>
  
  <p>First call in browser:</p>
  
  <pre><code>Date1: 2013-10-01 (date)
  Date2: 1 October 2013
  </code></pre>
  
  <p>After form submit:</p>
  
  <pre><code>Date1: (unicode)
  Date2: 2013-10-01
  </code></pre>
  
  <p>What am I doing wrong? What is the proper way to access form's field initial and submitted values?</p>
  
  <p>Thnak you.</p>