title: Edit the opposite side of a many to many relationship with django generic form
body: <p>I have two models:</p>
  
  <pre><code> class Actor(models.Model):
       name = models.CharField(max_length=30, unique = True)
       event = models.ManyToManyField(Event, blank=True, null=True)
  
   class Event(models.Model):
       name = models.CharField(max_length=30, unique = True)
       long_description = models.TextField(blank=True, null=True)
  </code></pre>
  
  <p>In a previous question: <a href="https://stackoverflow.com/questions/2503243/django-form-linking-2-models-by-many-to-many-field">Django form linking 2 models by many to many field</a>, I created an EventForm with a save function:</p>
  
  <pre><code>class EventForm(forms.ModelForm):
        class Meta:
              model = Event
  
        def save(self, commit=True):
              instance = forms.ModelForm.save(self)
              instance.actors_set.clear()
              for actor in self.cleaned_data['actors']:
                  instance.actors_set.add(actors)
              return instance
  </code></pre>
  
  <p>This allowed me to add m2m links from the other side of the defined m2m connection.</p>
  
  <p>Now I want to edit the entry.  I've been using a generic function:</p>
  
  <pre><code>def generic_edit(request, modelname, object_id):
         modelname = modelname.lower()
         form_class = form_dict[modelname]
         return update_object(request,
              form_class = form_class,
              object_id = object_id,
              template_name = 'createdit.html'
         )
  </code></pre>
  
  <p>but this pulls in all the info except the many-to-many selections saved to this object.</p>
  
  <p>I think I need to do something similar to this: <a href="https://stackoverflow.com/questions/1700202/editing-both-sides-of-m2m-in-admin-page">Editing both sides of M2M in Admin Page</a>, but I haven't figured it out.</p>
  
  <p>How do I use the generic update_object to edit the other side of many-to-many link?</p>