title: Django form is not rendered properly after setting initial values dynamically
body: <p>I am trying to render a form where more then one field are initialized dynamically based on a parameter passed from view to form.
  I am setting the initial value at the form's <strong>init</strong> method and it seems to work fine as far as assigning the values to field elements is considered.
  When I print the form, I can see those values attached to appropriate field element.
  The issue is that those values does not show up when rendered.</p>
  
  <p>My View is:</p>
  
  <pre><code>def zoneinfo(request):
      siteId = request.GET.get('siteId')
      form = PostForm(site = siteId.upper())
      print form
      return render(request, 'details.html', {'form': form})
  </code></pre>
  
  <p>code in form.py</p>
  
  <pre><code>def __init__(self, *args, **kwargs):
      siteId =  kwargs.pop('site', None)
      super(PostForm, self).__init__(*args, **kwargs)
      if siteId:
          siteInfo = getSiteInfo(siteId.upper())
          self.fields['city'] = forms.CharField(max_length=25, initial=siteInfo['city'])
          self.fields['address'] = forms.CharField(max_length=25, initial=siteInfo['address'])
          self.fields['state'] = forms.CharField(max_length=50, initial=siteInfo['state'])
          self.fields['zip'] = forms.CharField(max_length=10, initial=siteInfo['zip'])
  </code></pre>
  
  <p>details.html:</p>
  
  <pre><code>{% load staticfiles %}
  &lt;form action = "/zones/add" id="addNewZoneForm1" method='post'&gt;{% csrf_token %}
  &lt;!-- &lt;form  id="addNewSite" method='post'&gt;{% csrf_token %} --&gt;
      &lt;fieldset&gt;
          &lt;table border="0" cellspacing="2" cellpadding="2" width="100%"&gt;
              {{ form.as_table }}
        &lt;!-- Allow form submission with keyboard without duplicating the dialog button --&gt;
        &lt;/table&gt;
        &lt;input type="submit" value="Submit"&gt;
      &lt;/fieldset&gt;
  
  
  &lt;/form&gt;
  &lt;script type="text/javascript"&gt;
          function getSite(value){
          $.ajax({
               url: "sites/getinfo?siteId="+value,
               type: "get",
          })
      }
  &lt;/script&gt;
  </code></pre>
  
  <p>where Print form returns :</p>
  
  <pre><code>&lt;tr&gt;&lt;th&gt;&lt;label for="id_site"&gt;Site:&lt;/label&gt;&lt;/th&gt;&lt;td&gt;&lt;select id="id_site" name="site" onChange="getSite(this.value);"&gt;
  &lt;option value="initialValue"&gt;----Select Site----&lt;/option&gt;
  &lt;option value="abc"&gt;ABC&lt;/option&gt;
  &lt;option value="xyz"&gt;XYZ&lt;/option&gt;
  &lt;/select&gt;&lt;/td&gt;&lt;/tr&gt;
  &lt;tr&gt;&lt;th&gt;&lt;label for="id_city"&gt;City:&lt;/label&gt;&lt;/th&gt;&lt;td&gt;&lt;input id="id_city" maxlength="25" name="city" type="text" value="SAN" /&gt;&lt;/td&gt;&lt;/tr&gt;
  &lt;tr&gt;&lt;th&gt;&lt;label for="id_address"&gt;Address:&lt;/label&gt;&lt;/th&gt;&lt;td&gt;&lt;input id="id_address" maxlength="25" name="address" type="text" value="SAN" /&gt;&lt;/td&gt;&lt;/tr&gt;
  &lt;tr&gt;&lt;th&gt;&lt;label for="id_state"&gt;State:&lt;/label&gt;&lt;/th&gt;&lt;td&gt;&lt;input id="id_state" maxlength="50" name="state" type="text" value="SAN" /&gt;&lt;/td&gt;&lt;/tr&gt;
  &lt;tr&gt;&lt;th&gt;&lt;label for="id_zip"&gt;Zip:&lt;/label&gt;&lt;/th&gt;&lt;td&gt;&lt;input id="id_zip" maxlength="10" name="zip" type="text" value="10000001" /&gt;&lt;/td&gt;&lt;/tr&gt;
  &lt;tr&gt;&lt;th&gt;&lt;label for="id_description"&gt;Description:&lt;/label&gt;&lt;/th&gt;&lt;td&gt;&lt;textarea cols="40" id="id_description" name="description" rows="10"&gt;
  &lt;/textarea&gt;&lt;/td&gt;&lt;/tr&gt;
  </code></pre>
  
  <p>We can see in the html out put that the fields have values associated but they are not rendered in the view.
  There is no error that I am getting, just a form with empty fields</p>
  
  <p>EDIT: I tired to print return <code>render(request, 'details.html', {'form': form})</code> on console and the output contains the values for the fields. Not sure why those values are not visible on the web page.</p>
  
  <p>Thanks in advance for your help</p>