title: Django List objects that will be deleted by deleting the current object
body: <p>In my DeleteView template, I'd like to warn the user that deleting the current object will delete the following objects (since the db schema requires <code>on_delete = models.CASCADE</code>). </p>
  
  <p>Here is an example model:</p>
  
  <pre><code>class Book(models.Model):
      course = models.ForeignKey(Course, related_name = 'course_books', on_delete = models.CASCADE, null = True, blank = True)
  
  class Exercise(models.Model):
      book = models.ForeignKey(Book, related_name = 'exercises', on_delete = models.CASCADE, null = True, blank = True)
      ...
  
  class Solution(models.Model):
      exercise = models.ForeignKey(Exercise, related_name = 'solutions', on_delete = models.CASCADE, null = True, blank = True)
  </code></pre>
  
  <p>So, say the user wants to delete a course, I'd like to warn the user which books, exercises, and solutions will be deleted upon deleting the current book. Something to this effect:</p>
  
  <pre><code>WARNING: Deleting course Programming 101 will delete Python Programming for Beginners and Python By Example.  It will also delete Excersises 1-5 and solutions 1-10
  </code></pre>
  
  <p>This will require that I can look at the related field to see if the on_delete is set to CASCADE or not.  If it is, I should add it to the list of to_be_deleted objects.</p>
  
  <p>I have looked to see if I can check the on_delete attribute of the field:</p>
  
  <pre><code>for related_object in the_course._meta.related_objects:
      dir(related_object.field)
  </code></pre>
  
  <p>But nothing shows up to help so I'm reaching out here...</p>