Browse files

Removed Query.split_exclude()'s unused prefix argument.

Unused since b4492a8.
  • Loading branch information...
felixxm authored and timgraham committed Jan 13, 2018
1 parent b17c1d5 commit 385e6fb352f3cb80d2f72838e08372cb392aaa45
Showing with 5 additions and 6 deletions.
  1. +5 −6 django/db/models/sql/
@@ -1186,8 +1186,7 @@ def build_filter(self, filter_expr, branch_negated=False, current_negated=False,
# lookup parts
self._lookup_joins = join_info.joins
except MultiJoin as e:
- return self.split_exclude(filter_expr, LOOKUP_SEP.join(parts[:e.level]),
- can_reuse, e.names_with_path)
+ return self.split_exclude(filter_expr, can_reuse, e.names_with_path)
# Update used_joins before trimming since they are reused to determine
# which joins could be later promoted to INNER.
@@ -1524,16 +1523,16 @@ def resolve_ref(self, name, allow_joins=True, reuse=None, summarize=False):
col = targets[0].get_col(join_list[-1], join_info.targets[0])
return col
- def split_exclude(self, filter_expr, prefix, can_reuse, names_with_path):
+ def split_exclude(self, filter_expr, can_reuse, names_with_path):
When doing an exclude against any kind of N-to-many relation, we need
to use a subquery. This method constructs the nested query, given the
original exclude filter (filter_expr) and the portion up to the first
N-to-many relation field.
- As an example we could have original filter ~Q(child__name='foo').
- We would get here with filter_expr = child__name, prefix = child and
- can_reuse is a set of joins usable for filters in the original query.
+ For example, if the origin filter is ~Q(child__name='foo'), filter_expr
+ is ('child__name', 'foo') and can_reuse is a set of joins usable for
+ filters in the original query.
We will turn this into equivalent of:
WHERE NOT (pk IN (SELECT parent_id FROM thetable

0 comments on commit 385e6fb

Please sign in to comment.