'Passing a relationship field lookup specifier to select_related() will
stop the descent at a particular level. This can be used on lists as
well.'

def test_list_with_depth(self):

    with self.assertNumQueries(5):
        world = Species.objects.all().select_related('genus__family')
        orders = [o.genus.family.order.name for o in world]
        self.assertEqual(sorted(orders), ['Agaricales', 'Diptera', 'Fabales', 'Primates'])
