title: Django prefetch_related children of children
body: <p>I have a model <code>Node</code> that looks something like that:</p>
  
  <pre><code>class Node(models.Model):
      parent = models.ForeignKey('self', related_name='children', on_delete=models.CASCADE)
  </code></pre>
  
  <p>A Node can have several children, and each of these children can have its own children.</p>
  
  <p>If I do: </p>
  
  <pre><code>def show_child(node):
      for child in node.children.all():
          show_child(child)
  
  root_node = Node.objects.prefetch_related('children').get(pk=my_node_id) # hit database twice, as expected
  print("Now testing queries")
  root_node.children.all()  # no hit
  root_node.children.all()  # no hit
  root_node.children.all()  # no hit
  root_node.children.all()  # no hit
  print("Test 2")
  show_child(root_node)  # hit database for every loop except the first
  </code></pre>
  
  <p>The database gets hit every time I try to access the children of a child.</p>
  
  <p>How could I make it so that it gets the node, its children, the children of its children, etc, in a single database query?</p>