Ticket #12851: 12851_inheritance_regression_test.patch

File 12851_inheritance_regression_test.patch, 1.0 KB (added by Gregor Müllegger, 15 years ago)

The current fix for this bug does not work if you use model inheritance. Here is a failing testcase.

  • tests/regressiontests/select_related_regress/models.py

     
    6464    name = models.CharField(max_length=50)
    6565    state = models.ForeignKey(State, null=True)
    6666    status = models.ForeignKey(ClientStatus)
     67   
     68class SpecialClient(Client):
     69    value = models.IntegerField()
    6770
    6871# Some model inheritance exercises
    6972class Parent(models.Model):
     
    172175>>> burke = Client.objects.select_related('state').defer('state__name').get(name='Brian Burke')
    173176>>> burke.state.name
    174177u'Western Australia'
     178>>> _ = SpecialClient.objects.create(name='Markus McDonalds', state=wa, status=active, value=42)
     179>>> markus = SpecialClient.objects.select_related('state').defer('value', 'state__name').get(name='Markus McDonalds')
     180>>> markus.value
     18142
     182>>> markus.state.name
     183u'Western Australia'
    175184
    176185"""}
    177 
Back to Top