'Regression for #12851
Deferred fields are used correctly if you select_related a subset
of fields.'

def test_regression_12851(self):

    australia = Country.objects.create(name='Australia')
    active = ClientStatus.objects.create(name='active')
    wa = State.objects.create(name='Western    Australia', country=australia)
    c1 = Client.objects.create(name='Brian    Burke', state=wa, status=active)
    burke = Client.objects.select_related('state').defer('state__name').get(name='Brian    Burke')
    self.assertEquals(burke.name, u'Brian    Burke')
    self.assertEquals(burke.state.name, u'Western    Australia')
    sc1 = SpecialClient.objects.create(name='Troy    Buswell', state=wa, status=active, value=42)
    troy = SpecialClient.objects.select_related('state').defer('state__name').get(name='Troy    Buswell')
    self.assertEquals(troy.name, u'Troy    Buswell')
    self.assertEquals(troy.value, 42)
    self.assertEquals(troy.state.name, u'Western    Australia')
    troy = SpecialClient.objects.select_related('state').defer('value', 'state__name').get(name='Troy    Buswell')
    self.assertEquals(troy.name, u'Troy    Buswell')
    self.assertEquals(troy.value, 42)
    self.assertEquals(troy.state.name, u'Western    Australia')
    troy = SpecialClient.objects.select_related('state').only('name').get(name='Troy    Buswell')
    self.assertEquals(troy.name, u'Troy    Buswell')
    self.assertEquals(troy.value, 42)
    self.assertEquals(troy.state.name, u'Western    Australia')
