Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Fixed #2038 -- QuerySet._combine now combines where clause. Thanks, g…

…raham@darkcoding.net

git-svn-id: http://code.djangoproject.com/svn/django/trunk@3019 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 45518a052b5d014502d960911d1fda779b6fb90f 1 parent 192c726
Adrian Holovaty authored May 31, 2006

Showing 1 changed file with 5 additions and 1 deletion. Show diff stats Hide diff stats

  1. 6  django/db/models/query.py
6  django/db/models/query.py
@@ -315,7 +315,7 @@ def _filter_or_exclude(self, mapper, *args, **kwargs):
315 315
 
316 316
     def complex_filter(self, filter_obj):
317 317
         """Returns a new QuerySet instance with filter_obj added to the filters.
318  
-        filter_obj can be a Q object (has 'get_sql' method) or a dictionary of 
  318
+        filter_obj can be a Q object (has 'get_sql' method) or a dictionary of
319 319
         keyword lookup arguments."""
320 320
         # This exists to support framework features such as 'limit_choices_to',
321 321
         # and usually it will be more natural to use other methods.
@@ -380,6 +380,10 @@ def _combine(self, other):
380 380
         #  (so that A.filter(args1) & A.filter(args2) does the same as
381 381
         #   A.filter(args1).filter(args2)
382 382
         combined = other._clone()
  383
+        if self._select: combined._select.update(self._select)
  384
+        if self._where: combined._where.extend(self._where)
  385
+        if self._params: combined._params.extend(self._params)
  386
+        if self._tables: combined._tables.extend(self._tables)
383 387
         # If 'self' is ordered and 'other' isn't, propagate 'self's ordering
384 388
         if (self._order_by is not None and len(self._order_by) > 0) and \
385 389
            (combined._order_by is None or len(combined._order_by) == 0):

0 notes on commit 45518a0

Please sign in to comment.
Something went wrong with that request. Please try again.