title: django display ManyToManyField as a form field
body: <p>I am trying to display a ManyToManyField in my template:</p>
  
  <pre><code>class GvtCompo(models.Model):
      startDate=models.DateField(max_length=10, blank=False, null=False)
      endDate=models.DateField(max_length=10, blank=False, null=False)
      gvtCompo= models.CharField(max_length=1000, blank=False, null=False)
  
  class Act(models.Model):
      gvtCompo= models.ManyToManyField(GvtCompo)
  </code></pre>
  
  <p>In my view, I can display the object, no problem:</p>
  
  <pre><code>for gvtCompo in act.gvtCompo.all():
      print gvtCompo.gvtCompo
  </code></pre>
  
  <p>In my template, I have a list of "GvtCompo Object" with this code (not nice):</p>
  
  <pre><code>{% for field in form %}
      &lt;div class="fieldWrapper"&gt;
          {{ field.errors }}
          {{ field }}
      &lt;/div&gt;
  {% endfor %}
  </code></pre>
  
  <p>I have tried to make it nicer, but the following code just not work (nothing appears):</p>
  
  <pre><code>{% for field in form %}
      {% if field.name == "gvtCompo" %}
          {% for gvtCompo in field.gvtCompo.all %}
              {{ gvtCompo.gvtCompo }}
          {% endfor %}
      {% endif %}
  {% endfor %}
  </code></pre>
  
  <p>What's wrong?</p>
  
  <h2>*<em>Edit: *</em></h2>
  
  <p>If I don't use the form but an instance of the model (act) passed to render_to_response it displays the ManyToManyField values </p>
  
  <pre><code>{% for gvtCompo in field.gvtCompo.all %}
  </code></pre>
  
  <p>changed to</p>
  
  <pre><code>{% for gvtCompo in act.gvtCompo.all %}
  </code></pre>
  
  <p>However there is not form field anymore, so it can't be modified, validated and saved!</p>