Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fixed #7312 -- Fixed handling of custom Q-like objects in QuerySet.cu…

…stom_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
  • Loading branch information...
commit 36cb438373a264872e588ab615d8c22798ce0410 1 parent 9e23c3c
@malcolmt malcolmt authored
Showing with 3 additions and 1 deletion.
  1. +3 −1 django/db/models/query.py
View
4 django/db/models/query.py
@@ -492,7 +492,9 @@ def complex_filter(self, filter_obj):
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)

0 comments on commit 36cb438

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