diff options
Diffstat (limited to 'django/db/models/sql/where.py')
| -rw-r--r-- | django/db/models/sql/where.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/django/db/models/sql/where.py b/django/db/models/sql/where.py index 4e5a647259..e953bca703 100644 --- a/django/db/models/sql/where.py +++ b/django/db/models/sql/where.py @@ -267,8 +267,9 @@ class Constraint(object): An object that can be passed to WhereNode.add() and knows how to pre-process itself prior to including in the WhereNode. """ - def __init__(self, alias, col, field): + def __init__(self, alias, col, field, eliminatable_if=None): self.alias, self.col, self.field = alias, col, field + self.elimintable_if = eliminatable_if def __getstate__(self): """Save the state of the Constraint for pickling. @@ -321,6 +322,9 @@ class Constraint(object): except ObjectDoesNotExist: raise EmptyShortCircuit + if self.elimintable_if and self.elimintable_if(connection): + raise FullResultSet + return (self.alias, self.col, db_type), params def relabel_aliases(self, change_map): |
