diff options
| author | Adrian Holovaty <adrian@holovaty.com> | 2006-05-31 14:52:33 +0000 |
|---|---|---|
| committer | Adrian Holovaty <adrian@holovaty.com> | 2006-05-31 14:52:33 +0000 |
| commit | 45518a052b5d014502d960911d1fda779b6fb90f (patch) | |
| tree | 8b4f24fc19f4a33e10ca1525d5c16903fc80b183 | |
| parent | 192c726ee63badb428ddc579d9bd006c90b8b895 (diff) | |
Fixed #2038 -- QuerySet._combine now combines where clause. Thanks, graham@darkcoding.net
git-svn-id: http://code.djangoproject.com/svn/django/trunk@3019 bcc190cf-cafb-0310-a4f2-bffc1f526a37
| -rw-r--r-- | django/db/models/query.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/django/db/models/query.py b/django/db/models/query.py index 91ae294a62..fe31eaf45f 100644 --- a/django/db/models/query.py +++ b/django/db/models/query.py @@ -315,7 +315,7 @@ class QuerySet(object): def complex_filter(self, filter_obj): """Returns a new QuerySet instance with filter_obj added to the filters. - filter_obj can be a Q object (has 'get_sql' method) or a dictionary of + filter_obj can be a Q object (has 'get_sql' method) or a dictionary of keyword lookup arguments.""" # This exists to support framework features such as 'limit_choices_to', # and usually it will be more natural to use other methods. @@ -380,6 +380,10 @@ class QuerySet(object): # (so that A.filter(args1) & A.filter(args2) does the same as # A.filter(args1).filter(args2) combined = other._clone() + if self._select: combined._select.update(self._select) + if self._where: combined._where.extend(self._where) + if self._params: combined._params.extend(self._params) + if self._tables: combined._tables.extend(self._tables) # If 'self' is ordered and 'other' isn't, propagate 'self's ordering if (self._order_by is not None and len(self._order_by) > 0) and \ (combined._order_by is None or len(combined._order_by) == 0): |
