summaryrefslogtreecommitdiff
path: root/django/db/models/sql/query.py
diff options
context:
space:
mode:
authorMalcolm Tredinnick <malcolm.tredinnick@gmail.com>2009-02-28 03:02:52 +0000
committerMalcolm Tredinnick <malcolm.tredinnick@gmail.com>2009-02-28 03:02:52 +0000
commit106bd0f49ebbc0cf2d20a06082f552c71346fa0e (patch)
tree79d3db44609326999d3f28e2ea5b569b7223bed2 /django/db/models/sql/query.py
parent7fdd26c582f7fa0472322591ba1bb78d91975948 (diff)
[1.0.X] Fixed #10028 -- Fixed a problem when ordering by related models.
Some results were inadvertently being excluded if we were ordering across a nullable relation which itself ordering by a non-nullable relation. Backport of r9916 from trunk. git-svn-id: http://code.djangoproject.com/svn/django/branches/releases/1.0.X@9917 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django/db/models/sql/query.py')
-rw-r--r--django/db/models/sql/query.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/django/db/models/sql/query.py b/django/db/models/sql/query.py
index 1d4001bab0..bb4ce92f43 100644
--- a/django/db/models/sql/query.py
+++ b/django/db/models/sql/query.py
@@ -687,8 +687,9 @@ class BaseQuery(object):
# the model.
self.ref_alias(alias)
- # Must use left outer joins for nullable fields.
- self.promote_alias_chain(joins)
+ # Must use left outer joins for nullable fields and their relations.
+ self.promote_alias_chain(joins,
+ self.alias_map[joins[0]][JOIN_TYPE] == self.LOUTER)
# If we get to this point and the field is a relation to another model,
# append the default ordering for that model.