Index: db/models/query.py
===================================================================
--- db/models/query.py	(revision 4637)
+++ db/models/query.py	(working copy)
@@ -630,10 +630,42 @@
 
 class QOperator(object):
     "Base class for QAnd and QOr"
+    underneath_an_or = False # used to track ORs
+    checked_or       = False
+    
+    def search_for_or(self):
+        " Returns true if an or exists beneath this Q operator. "
+        if type(self) == QOr:
+            return True
+
+        for val in self.args:
+            if val.search_for_or():
+                return True
+
+        return False # there was no OR below this.
+
+    def set_or_found(self, or_value):
+        if self.checked_or:
+            return
+
+        self.underneath_an_or = or_value
+        self.checked_or       = True
+
+        for val in self.args:
+            val.set_or_found(or_value) # set for all the children
+        
     def __init__(self, *args):
         self.args = args
 
     def get_sql(self, opts):
+
+        if not self.checked_or:
+            found_an_or = self.underneath_an_or()
+            self.set_or_found(found_an_or)
+
+        # now that we've finished building the query
+        self.checked_or = False
+
         joins, where, params = SortedDict(), [], []
         for val in self.args:
             try:
@@ -678,6 +710,11 @@
 
 class Q(object):
     "Encapsulates queries as objects that can be combined logically."
+    underneath_an_or = False
+    checked_or       = False
+    outer_join       = 'LEFT OUTER JOIN'
+    inner_join       = 'INNER JOIN'
+    
     def __init__(self, **kwargs):
         self.kwargs = kwargs
 
@@ -687,9 +724,39 @@
     def __or__(self, other):
         return QOr(self, other)
 
+    def search_for_or(self):
+        ' Returns false, since there are no OR Qs below. '
+        return False
+
+    def set_or_found(self, or_found):
+        """ Set whether or not we have an OR above us. """
+        if not self.checked_or:
+            self.underneath_an_or = or_found
+            self.checked_or       = True  # we checked for an OR
+
     def get_sql(self, opts):
-        return parse_lookup(self.kwargs.items(), opts)
+        # we will check to see if it's an OR, and change the join
+        # based upon that
 
+        if self.underneath_an_or:
+            join_text = self.outer_join
+        else:
+            join_text = self.inner_join
+
+        joins, where, params = parse_lookup(self.kwargs.items(), opts)
+
+        joins2 = {}
+        for item, key in joins.items():
+            # now we will fix the joins dictionary with
+            # the new type of join
+            joins2[item] = (key[0], join_text, key[2])
+
+        # now that we've done creating the query,
+        # it's best that we let ourselves search again
+        self.checked_or = False
+
+        return joins2, where, params
+
 class QNot(Q):
     "Encapsulates NOT (...) queries as objects"
     def __init__(self, q):
