'Ensure select_related together with only on a proxy model behaves
as expected. See #17876.'

def test_defer_proxy(self):

    related = Secondary.objects.create(first='x1', second='x2')
    ChildProxy.objects.create(name='p1', value='xx', related=related)
    children = ChildProxy.objects.all().select_related().only('id', 'name')
    self.assertEqual(len(children), 1)
    child = children[0]
    self.assert_delayed(child, 2)
    self.assertEqual(child.name, 'p1')
    self.assertEqual(child.value, 'xx')
