#8036: select_related() yields unexpected results with certain combinations of
*fields
---------------------------------------+------------------------------------
Reporter: mrmachine | Owner: mtredinnick
Status: reopened | Milestone: 1.0
Component: Database wrapper | Version: SVN
Resolution: | Keywords: select_related
Stage: Accepted | Has_patch: 0
Needs_docs: 0 | Needs_tests: 0
Needs_better_patch: 0 |
---------------------------------------+------------------------------------
Changes (by mrmachine):
* status: closed => reopened
* resolution: fixed =>
Comment:
The problem still exists in [8571]. I've attached tests with as few models
and fields as possible. The tests show that `select_related()` (without
*fields) and `select_related('state__country')` (with *fields) work, but
`select_related('state__country', 'status')` (certain combination of
*fields) fails.
{{{
18:02:28 [EMAIL PROTECTED] ~/Subversion/django/django$ dpath
../tests/runtests.py --settings=django.settings select_related_regress
======================================================================
FAIL: Doctest:
regressiontests.select_related_regress.models.__test__.API_TESTS
----------------------------------------------------------------------
Traceback (most recent call last):
File "/Users/tailee/Subversion/django/django/test/_doctest.py", line
2180, in runTest
raise self.failureException(self.format_failure(new.getvalue()))
AssertionError: Failed doctest test for
regressiontests.select_related_regress.models.__test__.API_TESTS
File
"/Users/tailee/Subversion/django/tests/regressiontests/select_related_regress/models.py",
line unknown line number, in API_TESTS
----------------------------------------------------------------------
File
"/Users/tailee/Subversion/django/tests/regressiontests/select_related_regress/models.py",
line ?, in
regressiontests.select_related_regress.models.__test__.API_TESTS
Failed example:
Client.objects.select_related('state__country',
'status').latest('id').status
Expected:
<ClientStatus: ClientStatus object>
Got nothing
----------------------------------------------------------------------
Ran 1 test in 0.024s
FAILED (failures=1)
}}}
--
Ticket URL: <http://code.djangoproject.com/ticket/8036#comment:4>
Django Code <http://code.djangoproject.com/>
The web framework for perfectionists with deadlines
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---