filter_q: allow empty Q() objects
This commit is contained in:
parent
eaf1d20427
commit
9fff9e5dcb
1 changed files with 2 additions and 0 deletions
|
@ -603,6 +603,8 @@ class BaseQueryWrapper(BaseWrapper):
|
|||
Split it up into recursive _filter_q and _filter_kwarg calls and combine them again.
|
||||
:return: new Q object and set of matched existing pks
|
||||
"""
|
||||
if not q.children:
|
||||
return q, self._get_initial_created_pks()
|
||||
filters, created_pks = zip(*((self._filter_q(c) if isinstance(c, Q) else self._filter_kwarg(*c))
|
||||
for c in q.children))
|
||||
result = Q(*filters)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue