'#23370 - Should be able to defer child fields when using
select_related() from parent to child.'

def test_select_related_defer(self):

    Restaurant.objects.create(name=u'Demon    Dogs', address=u'944    W.    Fullerton', serves_hot_dogs=True, serves_pizza=False, rating=2)
    ItalianRestaurant.objects.create(name=u'Ristorante    Miron', address=u'1234    W.    Ash', serves_hot_dogs=False, serves_pizza=False, serves_gnocchi=True, rating=4)
    qs = Restaurant.objects.select_related(u'italianrestaurant').defer(u'italianrestaurant__serves_gnocchi').order_by(u'rating')
    with self.assertNumQueries(2):
        objs = list(qs.all())
        self.assertTrue(objs[1].italianrestaurant.serves_gnocchi)
    self.assertEqual(qs[0].name, u'Demon    Dogs')
    self.assertEqual(qs[0].rating, 2)
    self.assertEqual(qs[1].italianrestaurant.name, u'Ristorante    Miron')
    self.assertEqual(qs[1].italianrestaurant.rating, 4)
