title: django ManyToManyField and on_delete
body: <p><code>ForeignKey</code>s on django have the attribute <a href="https://docs.djangoproject.com/en/dev/ref/models/fields/#django.db.models.ForeignKey.on_delete" rel="noreferrer">on_delete</a> to specify the behavior when the referenced object is deleted. Is there any way to get something similar for <a href="https://docs.djangoproject.com/en/dev/ref/models/fields/#django.db.models.ManyToManyField" rel="noreferrer">ManyToManyField</a>?</p>
  
  <p>Suppose I have the following model</p>
  
  <pre><code>class House(models.Model):
      owners = models.ManyToManyField(Person)
  </code></pre>
  
  <p>The default behavior is to cascade, so if I delete a person that happens to own a house, it just vanishes from owners (that is, obviously, it no longer owns any houses). What I'd like to have is that if a person is an owner, it can not be deleted. That is, I want <code>on_delete=models.PROTECT</code>. Is this possible?</p>
  
  <p>I know internally <code>ManyToManyField</code> is translated to another model with two <code>ForeignKey</code>s (in this case one to house and one to person), so it should be possible to achieve this. Any ideas how to? I'd like to avoid setting the <a href="https://docs.djangoproject.com/en/dev/ref/models/fields/#django.db.models.ManyToManyField.through" rel="noreferrer">through</a> attribute to a new model, because this would result in a new table (I'd like to keep the old one). </p>
  
  <p>Edit: I've tracked where django creates the appropriate m2m model:</p>
  
  <pre><code>def create_many_to_many_intermediary_model(field, klass):
      from django.db import models
      # ... 
      # Construct and return the new class.
      return type(name, (models.Model,), {
          'Meta': meta,
          '__module__': klass.__module__,
          from_: models.ForeignKey(klass,
                                   related_name='%s+' % name,
                                   db_tablespace=field.db_tablespace),
          to: models.ForeignKey(to_model,
                                related_name='%s+' % name,
                                db_tablespace=field.db_tablespace)
      })
  </code></pre>
  
  <p>The relevant line is </p>
  
  <pre><code>to: models.ForeignKey(to_model,
                        related_name='%s+' % name,
                        db_tablespace=field.db_tablespace)
  </code></pre>
  
  <p>I'd like it to be </p>
  
  <pre><code>to: models.ForeignKey(to_model,
                        related_name='%s+' % name,
                        db_tablespace=field.db_tablespace,
                        on_delete=models.PROTECT)
  </code></pre>
  
  <p>Any way to do this other than monkey patching the whole thing and creating a new class for ManyToManyField?</p>