title: How do you update a many to many field from a form?
body: <p>I have the following two models:</p>
  
  <pre><code>class TaskFile(models.Model):
      file = models.FileField(upload_to='task-files/')
  
      def __str__(self):
          return self.file.name
  
  class Task(models.Model):
      lesson = models.ManyToManyField(TaskFile, related_name='task_files')
  </code></pre>
  
  <p>I have a model form to update the Task object that is already created, but the many to many relationships do not show up in the form. It just shows the option to upload a file and does not show the existing files in that object. </p>
  
  <p>How can I fix this?</p>
  
  <p>Edit:</p>
  
  <p>This is my model form code:</p>
  
  <pre><code>class TutorTaskSelectForm(forms.ModelForm):
      lesson = forms.FileField(widget=forms.ClearableFileInput(attrs={'multiple': True}))
  
      class Meta:
          model = Task
          fields = ('lesson')
  </code></pre>
  
  <p>This is my template:</p>
  
  <pre><code>&lt;form action="{{request.path}}" method="POST" enctype="multipart/form-data"&gt;
   {%csrf_token%}
    &lt;div class="box-body"&gt;
       &lt;div class="form-group"&gt;
         &lt;label for="inputEmail3" class="col-sm-2 control-label"&gt;Number&lt;/label&gt;
  
         &lt;div class="col-sm-10"&gt;
           {{form.lesson}}
         &lt;/div&gt;
       &lt;/div&gt;
     &lt;/div&gt;
   &lt;/form&gt;
  </code></pre>