diff options
| author | Malcolm Tredinnick <malcolm.tredinnick@gmail.com> | 2008-06-26 13:25:59 +0000 |
|---|---|---|
| committer | Malcolm Tredinnick <malcolm.tredinnick@gmail.com> | 2008-06-26 13:25:59 +0000 |
| commit | 36cb438373a264872e588ab615d8c22798ce0410 (patch) | |
| tree | 84e90c6da5cf30278ea7130a1dec2d4b053b7544 | |
| parent | 9e23c3c5d9d796540356906399365c651e07f084 (diff) | |
Fixed #7312 -- Fixed handling of custom Q-like objects in QuerySet.custom_filter().
This is pretty much internal-use-only code, so doesn't affect public API at
all, but it's nice to be able to handle things properly in any case. Patch from
emulbreh.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@7766 bcc190cf-cafb-0310-a4f2-bffc1f526a37
| -rw-r--r-- | django/db/models/query.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/django/db/models/query.py b/django/db/models/query.py index fef71640b6..98caaf004c 100644 --- a/django/db/models/query.py +++ b/django/db/models/query.py @@ -492,7 +492,9 @@ class QuerySet(object): and usually it will be more natural to use other methods. """ if isinstance(filter_obj, Q) or hasattr(filter_obj, 'add_to_query'): - return self._filter_or_exclude(None, filter_obj) + clone = self._clone() + clone.query.add_q(filter_obj) + return clone else: return self._filter_or_exclude(None, **filter_obj) |
