title: How do I stop this cascading delete from happening in Django?
body: <p>I have three model classes in a Django app:</p>
  
  <pre><code>class Folder(models.Model):
    ...
    folder = models.ForeignKey('Folder',null=True,blank=True,related_name='folders')
    front_thumbnail_image = models.ForeignKey('Image',verbose_name='Front Thumbnail',null=True,blank=True,related_name='front_thumbnail_for_folders')
    middle_thumbnail_image = models.ForeignKey('Image',verbose_name='Middle Thumbnail',null=True,blank=True,related_name='middle_thumbnail_for_folders')
    back_thumbnail_image = models.ForeignKey('Image',verbose_name='Back Thumbnail',null=True,blank=True,related_name='back_thumbnail_for_folders')
  
  class Image(models.Model):
    ...
    folder = models.ForeignKey(Folder,related_name='images',null=True)
  
  class ImageRepresentation(models.Model):
    ...
    image = models.ForeignKey(Image, related_name="image_representations")
  </code></pre>
  
  <p>Given this model, when I delete an <code>Image</code> in the admin site, I would expect the <code>ImageRepresentation</code>s associated with that <code>Image</code> to be deleted as well, and the <code>Folder</code> enclosing that <code>Image</code> to be left alone.</p>
  
  <p>The admin site tells me that the enclosing <code>Folder</code> will be deleted as well. What can I do to get the desired behavior? I looked into delete cascade rules, but nothing I tried seemed to work.</p>
  
  <p><strong>Edited</strong> to add three foreign keys on <code>Folder</code> (the thumbnail image ones)... I totally overlooked those (obviously). There are no other relationships, honest.</p>