'The "depth" argument to select_related() will stop the descent at a
particular level.'

def test_depth(self, depth=1, expected=7):

    def test():
        pea = Species.objects.select_related(depth=depth).get(name='sativum')
        self.assertEqual(pea.genus.family.order.klass.phylum.kingdom.domain.name, 'Eukaryota')
    self.assertNumQueries(expected, test)
