diff options
| author | Josh Smeaton <josh.smeaton@gmail.com> | 2013-12-26 00:13:18 +1100 |
|---|---|---|
| committer | Marc Tamlyn <marc.tamlyn@gmail.com> | 2014-11-15 14:00:43 +0000 |
| commit | f59fd15c4928caf3dfcbd50f6ab47be409a43b01 (patch) | |
| tree | fe4a04d98359e1ffcbfe991303eb97d9a8e16afc /django/db/models/sql/where.py | |
| parent | 39e3ef88c237e3f4cedc89cd36494a6d3f490812 (diff) | |
Fixed #14030 -- Allowed annotations to accept all expressions
Diffstat (limited to 'django/db/models/sql/where.py')
| -rw-r--r-- | django/db/models/sql/where.py | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/django/db/models/sql/where.py b/django/db/models/sql/where.py index f65e593a3a..13815cb68c 100644 --- a/django/db/models/sql/where.py +++ b/django/db/models/sql/where.py @@ -10,7 +10,6 @@ import warnings from django.conf import settings from django.db.models.fields import DateTimeField, Field from django.db.models.sql.datastructures import EmptyResultSet, Empty -from django.db.models.sql.aggregates import Aggregate from django.utils.deprecation import RemovedInDjango19Warning from django.utils.six.moves import xrange from django.utils import timezone @@ -78,7 +77,7 @@ class WhereNode(tree.Node): else: value_annotation = bool(value) - if hasattr(obj, "prepare"): + if hasattr(obj, 'prepare'): value = obj.prepare(lookup_type, value) return (obj, lookup_type, value_annotation, value) @@ -187,11 +186,9 @@ class WhereNode(tree.Node): lvalue, params = lvalue.process(lookup_type, params_or_value, connection) except EmptyShortCircuit: raise EmptyResultSet - elif isinstance(lvalue, Aggregate): - params = lvalue.field.get_db_prep_lookup(lookup_type, params_or_value, connection) else: - raise TypeError("'make_atom' expects a Constraint or an Aggregate " - "as the first item of its 'child' argument.") + raise TypeError("'make_atom' expects a Constraint as the first " + "item of its 'child' argument.") if isinstance(lvalue, tuple): # A direct database column lookup. |
