diff --git a/django/core/db/backends/ado_mssql.py b/django/core/db/backends/ado_mssql.py index b6b61d4129..bb5b628aca 100644 --- a/django/core/db/backends/ado_mssql.py +++ b/django/core/db/backends/ado_mssql.py @@ -132,12 +132,6 @@ OPERATOR_MAPPING = { 'endswith': 'LIKE %s', 'istartswith': 'LIKE %s', 'iendswith': 'LIKE %s', - 'notcontains': 'NOT LIKE %s', - 'notstartswith': 'NOT LIKE %s', - 'notendswith': 'NOT LIKE %s', - 'inotcontains': 'NOT LIKE %s', - 'inotstartswith': 'NOT LIKE %s', - 'inotendswith': 'NOT LIKE %s', } DATA_TYPES = { diff --git a/django/core/db/backends/mysql.py b/django/core/db/backends/mysql.py index 8f9bfd26b3..0e31af13fc 100644 --- a/django/core/db/backends/mysql.py +++ b/django/core/db/backends/mysql.py @@ -146,12 +146,6 @@ OPERATOR_MAPPING = { 'endswith': 'LIKE BINARY %s', 'istartswith': 'LIKE %s', 'iendswith': 'LIKE %s', - 'notcontains': 'NOT LIKE BINARY %s', - 'notstartswith': 'NOT LIKE BINARY %s', - 'notendswith': 'NOT LIKE BINARY %s', - 'inotcontains': 'NOT LIKE %s', - 'inotstartswith': 'NOT LIKE %s', - 'inotendswith': 'NOT LIKE %s', } # This dictionary maps Field objects to their associated MySQL column diff --git a/django/core/db/backends/postgresql.py b/django/core/db/backends/postgresql.py index f62f7b3585..c650660ad8 100644 --- a/django/core/db/backends/postgresql.py +++ b/django/core/db/backends/postgresql.py @@ -151,12 +151,6 @@ OPERATOR_MAPPING = { 'endswith': 'LIKE %s', 'istartswith': 'ILIKE %s', 'iendswith': 'ILIKE %s', - 'notcontains': 'NOT LIKE %s', - 'notstartswith': 'NOT LIKE %s', - 'notendswith': 'NOT LIKE %s', - 'inotcontains': 'NOT ILIKE %s', - 'inotstartswith': 'NOT ILIKE %s', - 'inotendswith': 'NOT ILIKE %s', } # This dictionary maps Field objects to their associated PostgreSQL column diff --git a/django/core/db/backends/sqlite3.py b/django/core/db/backends/sqlite3.py index 1ff74ea0e8..1a4a80d632 100644 --- a/django/core/db/backends/sqlite3.py +++ b/django/core/db/backends/sqlite3.py @@ -153,12 +153,6 @@ OPERATOR_MAPPING = { 'endswith': "LIKE %s ESCAPE '\\'", 'istartswith': "LIKE %s ESCAPE '\\'", 'iendswith': "LIKE %s ESCAPE '\\'", - 'notcontains': "NOT LIKE %s ESCAPE '\\'", - 'notstartswith': "NOT LIKE %s ESCAPE '\\'", - 'notendswith': "NOT LIKE %s ESCAPE '\\'", - 'inotcontains': "NOT LIKE %s ESCAPE '\\'", - 'inotstartswith': "NOT LIKE %s ESCAPE '\\'", - 'inotendswith': "NOT LIKE %s ESCAPE '\\'", } # SQLite doesn't actually support most of these types, but it "does the right diff --git a/django/core/meta/fields.py b/django/core/meta/fields.py index 19f827c800..c45c7b6e02 100644 --- a/django/core/meta/fields.py +++ b/django/core/meta/fields.py @@ -181,13 +181,13 @@ class Field(object): return value elif lookup_type == 'year': return ['%s-01-01' % value, '%s-12-31' % value] - elif lookup_type in ('contains', 'icontains', 'notcontains', 'inotcontains'): + elif lookup_type in ('contains', 'icontains'): return ["%%%s%%" % prep_for_like_query(value)] elif lookup_type == 'iexact': return [prep_for_like_query(value)] - elif lookup_type in ('startswith', 'istartswith', 'notstartswith', 'inotstartswith'): + elif lookup_type in ('startswith', 'istartswith'): return ["%s%%" % prep_for_like_query(value)] - elif lookup_type in ('endswith', 'iendswith', 'notendswith', 'inotendswith'): + elif lookup_type in ('endswith', 'iendswith'): return ["%%%s" % prep_for_like_query(value)] elif lookup_type == 'isnull': return [] diff --git a/docs/db-api.txt b/docs/db-api.txt index a1fd8b147b..3cee4d6c6e 100644 --- a/docs/db-api.txt +++ b/docs/db-api.txt @@ -152,51 +152,45 @@ translates (roughly) into the following SQL:: The DB API supports the following lookup types: - ============= ============================================================== - Type Description - ============= ============================================================== - exact Exact match: ``polls.get_object(id__exact=14)``. - iexact Case-insensitive exact match: - ``polls.get_list(slug__iexact="foo")`` matches a slug of - ``foo``, ``FOO``, ``fOo``, etc. - contains Case-sensitive containment test: - ``polls.get_list(question__contains="spam")`` returns all polls - that contain "spam" in the question. (PostgreSQL and MySQL - only. SQLite doesn't support case-sensitive LIKE statements; - ``contains`` will act like ``icontains`` for SQLite.) - notcontains negated ``contains`` - icontains Case-insensitive containment test. - inotcontains negated ``icontains`` - gt Greater than: ``polls.get_list(id__gt=4)``. - gte Greater than or equal to. - lt Less than. - lte Less than or equal to. - ne Not equal to. - in In a given list: ``polls.get_list(id__in=[1, 3, 4])`` returns - a list of polls whose IDs are either 1, 3 or 4. - startswith Case-sensitive starts-with: - ``polls.get_list(question_startswith="Would")``. (PostgreSQL - and MySQL only. SQLite doesn't support case-sensitive LIKE - statements; ``startswith`` will act like ``istartswith`` for - SQLite.) - notstartswith negated ``startswith`` - endswith Case-sensitive ends-with. (PostgreSQL and MySQL only.) - notendswith negated ``endswith`` - istartswith Case-insensitive starts-with. - inotstartswith negated ``istartswith`` - iendswith Case-insensitive ends-with. - inotendswith negated ``iendswith`` - range Range test: - ``polls.get_list(pub_date__range=(start_date, end_date))`` - returns all polls with a pub_date between ``start_date`` - and ``end_date`` (inclusive). - year For date/datetime fields, exact year match: - ``polls.get_count(pub_date__year=2005)``. - month For date/datetime fields, exact month match. - day For date/datetime fields, exact day match. - isnull True/False; does is IF NULL/IF NOT NULL lookup: - ``polls.get_list(expire_date__isnull=True)``. - ============= ============================================================== + =========== ============================================================== + Type Description + =========== ============================================================== + exact Exact match: ``polls.get_object(id__exact=14)``. + iexact Case-insensitive exact match: + ``polls.get_list(slug__iexact="foo")`` matches a slug of + ``foo``, ``FOO``, ``fOo``, etc. + contains Case-sensitive containment test: + ``polls.get_list(question__contains="spam")`` returns all polls + that contain "spam" in the question. (PostgreSQL and MySQL + only. SQLite doesn't support case-sensitive LIKE statements; + ``contains`` will act like ``icontains`` for SQLite.) + icontains Case-insensitive containment test. + gt Greater than: ``polls.get_list(id__gt=4)``. + gte Greater than or equal to. + lt Less than. + lte Less than or equal to. + ne Not equal to. + in In a given list: ``polls.get_list(id__in=[1, 3, 4])`` returns + a list of polls whose IDs are either 1, 3 or 4. + startswith Case-sensitive starts-with: + ``polls.get_list(question_startswith="Would")``. (PostgreSQL + and MySQL only. SQLite doesn't support case-sensitive LIKE + statements; ``startswith`` will act like ``istartswith`` for + SQLite.) + endswith Case-sensitive ends-with. (PostgreSQL and MySQL only.) + istartswith Case-insensitive starts-with. + iendswith Case-insensitive ends-with. + range Range test: + ``polls.get_list(pub_date__range=(start_date, end_date))`` + returns all polls with a pub_date between ``start_date`` + and ``end_date`` (inclusive). + year For date/datetime fields, exact year match: + ``polls.get_count(pub_date__year=2005)``. + month For date/datetime fields, exact month match. + day For date/datetime fields, exact day match. + isnull True/False; does is IF NULL/IF NOT NULL lookup: + ``polls.get_list(expire_date__isnull=True)``. + =========== ============================================================== Multiple lookups are allowed, of course, and are translated as "AND"s::