title: How to assign a value to a django form field in the template?
body: <p>I was wondering how you can assign a value to a django form field in the template.</p>
  
  <p>I know that there is other ways to assign an initial value in django, but I need to assign the value in the template because the variable is only present in the template.</p>
  
  <p>The way to do this with a normal html form would be this:</p>
  
  <pre><code>{% for thing in things %}
    &lt;p&gt; {{ thing.content }} &lt;/p&gt;
    &lt;!-- Reply form --&gt;
    &lt;form&gt;
      &lt;input type="hidden" name="replyingto" value="{{ thing.number }}"&gt;
      &lt;input type="text" label="Reply"&gt;&lt;/input&gt;
    &lt;/form&gt;
  {% endfor %}
  </code></pre>
  
  <p>However, I need to use a django form.</p>
  
  <p>I also know there is a way to assign a label to a field in the template, like this:</p>
  
  <pre><code>{{ form.non_field_errors }}
  {{ form.field.errors }}
     &lt;label for="{{ form.field.id_for_label }}"&gt; field &lt;/label&gt;
  {{ form.field }}
  </code></pre>
  
  <p>So my question is basically how you would go about doing the example above but instead of assigning a label, assign a value.</p>
  
  <hr>
  
  <p>I've found a solution!</p>
  
  <p>What I did was type the html manually as <a href="https://stackoverflow.com/users/104349/daniel-roseman/" title="Daniel">Daniel</a> suggested and assigned the value that way.</p>
  
  <p>For anyone who is wondering how I did it here is an <a href="https://docs.djangoproject.com/en/1.7/topics/forms/#form-rendering-options" rel="noreferrer">example</a>.</p>