diff options
| author | Russell Keith-Magee <russell@keith-magee.com> | 2010-04-30 16:37:54 +0000 |
|---|---|---|
| committer | Russell Keith-Magee <russell@keith-magee.com> | 2010-04-30 16:37:54 +0000 |
| commit | fe3b75e2764caf3fe7038fc30644e01f14cfc247 (patch) | |
| tree | e58838ac4181836021c2d627a713ed42cc680372 /tests | |
| parent | 868acb3a6c39b73389511f9d65e8849f27e63755 (diff) | |
[1.1.X] Fixed #12851 -- Another attempt at fixing select_related() with inherited models, this time with only(). Thanks to phxx for the test case.
Backport of r13059 from trunk.
git-svn-id: http://code.djangoproject.com/svn/django/branches/releases/1.1.X@13060 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/regressiontests/select_related_regress/models.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/tests/regressiontests/select_related_regress/models.py b/tests/regressiontests/select_related_regress/models.py index c99bee0f7e..a673809369 100644 --- a/tests/regressiontests/select_related_regress/models.py +++ b/tests/regressiontests/select_related_regress/models.py @@ -197,4 +197,13 @@ u'Troy Buswell' >>> troy.state.name u'Western Australia' +# Also works if you use only, rather than defer +>>> troy = SpecialClient.objects.select_related('state').only('name').get(name='Troy Buswell') +>>> troy.name +u'Troy Buswell' +>>> troy.value +42 +>>> troy.state.name +u'Western Australia' + """} |
