summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Graham <timograham@gmail.com>2016-04-14 21:31:23 -0400
committerTim Graham <timograham@gmail.com>2016-04-25 08:31:32 -0400
commit1ba0b22a7a262e63cb7152ef3ab513660156d135 (patch)
tree844d93d4f03ca955e79038543d2e7858ec23ef12
parentb454e2cbc95eb26fa0c32b54c53ae24fc40e8c02 (diff)
Refs #22936 -- Removed unused code in Field.get_db_prep_lookup().
-rw-r--r--django/db/models/fields/__init__.py22
1 files changed, 2 insertions, 20 deletions
diff --git a/django/db/models/fields/__init__.py b/django/db/models/fields/__init__.py
index 72d5990dc5..447556cb8c 100644
--- a/django/db/models/fields/__init__.py
+++ b/django/db/models/fields/__init__.py
@@ -20,7 +20,7 @@ from django.core import checks, exceptions, validators
# purposes.
from django.core.exceptions import FieldDoesNotExist # NOQA
from django.db import connection, connections, router
-from django.db.models.query_utils import QueryWrapper, RegisterLookupMixin
+from django.db.models.query_utils import RegisterLookupMixin
from django.utils import six, timezone
from django.utils.datastructures import DictWrapper
from django.utils.dateparse import (
@@ -780,31 +780,13 @@ class Field(RegisterLookupMixin):
if not prepared:
value = self.get_prep_lookup(lookup_type, value)
prepared = True
- if hasattr(value, 'get_compiler'):
- value = value.get_compiler(connection=connection)
- if hasattr(value, 'as_sql') or hasattr(value, '_as_sql'):
- # If the value has a relabeled_clone method it means the
- # value will be handled later on.
- if hasattr(value, 'relabeled_clone'):
- return value
- if hasattr(value, 'as_sql'):
- sql, params = value.as_sql()
- else:
- sql, params = value._as_sql(connection=connection)
- return QueryWrapper(('(%s)' % sql), params)
- if lookup_type in ('search', 'regex', 'iregex', 'contains',
- 'icontains', 'iexact', 'startswith', 'endswith',
- 'istartswith', 'iendswith'):
- return [value]
- elif lookup_type in ('exact', 'gt', 'gte', 'lt', 'lte'):
+ if lookup_type in ('exact', 'gt', 'gte', 'lt', 'lte'):
return [self.get_db_prep_value(value, connection=connection,
prepared=prepared)]
elif lookup_type in ('range', 'in'):
return [self.get_db_prep_value(v, connection=connection,
prepared=prepared) for v in value]
- elif lookup_type == 'isnull':
- return []
else:
return [value]