title: Django select_related on chained foreign keys
body: <p>I read the documentation and all the related questions here but I haven't properly understood how <strong>select_related</strong> behaves on chained/multiple foreign keys. </p>
  
  <p>Assume we have the following models:</p>
  
  <pre><code>class RecordLabel(models.Model):
     title = models.CharField(...)
  
  class Band(models.Model):
     band_name = models.CharField(...)
  
  class Artist(models.Model):
     record_label = models.ForeignKey(RecordLabel,...)
     belongs_to_band = models.ForeignKey(Band, ...)
  
  class Producer(models.Model):
     customer = models.ForeignKey(Artist, ...)
  </code></pre>
  
  <p><strong>A.</strong> How would we use select_related in a </p>
  
  <pre><code>Producer.objects.filter(...).select_related(?)
  </code></pre>
  
  <p>query so that everything is preloaded? Would it be like: </p>
  
  <pre><code>Producer.objects.filter(...).select_related(
      'customer__record_label', 'customer__belongs_to_band')
  </code></pre>
  
  <p>and why?</p>
  
  <p><strong>B.</strong> If class Band had 'Genre' as a foreign key,</p>
  
  <pre><code> class Genre(models.Model):
         genre_name = models.CharField(...)        
  
   class Band(models.Model):
         band_name = models.CharField(...)
         music_genre = models.ForeignKey(Genres, ...)
  </code></pre>
  
  <p>then in order to have everything preloaded we would do something like this:</p>
  
  <pre><code>Producer.objects.filter(...).select_related(
      'customer__record_label__music_genre', 'customer__record_label__band_name',
      'customer__belongs_to_band__music_genre', 'customer__belongs_to_band__music_genre') 
  </code></pre>
  
  <p>or something like this:</p>
  
  <pre><code>Producer.objects.filter(...).select_related(
      'customer__record_label__music_genre', 'customer__record_label__band_name',
      'customer__belongs_to_band', 'customer__belongs_to_band') 
  </code></pre>