title: Nested conversation list with django
body: <p>Hay I have a model like this</p>
  
  <pre><code>def Photo(models.Model):
      # Photo object fields...
  
  def PhotoThread(models.Model):
      photo = models.ForeignKey(Photo)
      message = models.TextField(blank=True)
      reply_to = models.ForeignKey('self', related_name='replies', null=True, blank=True)
      votes = models.IntegerField()
  </code></pre>
  
  <p>As you can see a Thread object has a reply_to field, so that Threads can become children of other Threads.</p>
  
  <p>I can do stuff like -</p>
  
  <pre><code>photo = Photo.objects.get(pk=1)
  threads = photo.photothread_set.all()
  </code></pre>
  
  <p>This will get the threads to a Photo, however, this system allows replies to also have replies.</p>
  
  <p>How would i go about looping through all replies and getting replies for those (all the way down to the maxiumum number of replies we have).</p>
  
  <p>I want to display this as a nested HTML list. Also i want to be able to order all Threads and replies by the 'votes' field.</p>
  
  <p>Thanks</p>