Django

Code

Changeset 1541

Show
Ignore:
Timestamp:
12/04/05 12:54:44 (3 years ago)
Author:
hugo
Message:

reverted changes from [1534] and [1536] regarding ticket #966

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • django/trunk/django/core/db/backends/ado_mssql.py

    r1534 r1541  
    133133    'istartswith': 'LIKE %s', 
    134134    'iendswith': 'LIKE %s', 
    135     'notcontains': 'NOT LIKE %s', 
    136     'notstartswith': 'NOT LIKE %s', 
    137     'notendswith': 'NOT LIKE %s', 
    138     'inotcontains': 'NOT LIKE %s', 
    139     'inotstartswith': 'NOT LIKE %s', 
    140     'inotendswith': 'NOT LIKE %s', 
    141135} 
    142136 
  • django/trunk/django/core/db/backends/mysql.py

    r1534 r1541  
    147147    'istartswith': 'LIKE %s', 
    148148    'iendswith': 'LIKE %s', 
    149     'notcontains': 'NOT LIKE BINARY %s', 
    150     'notstartswith': 'NOT LIKE BINARY %s', 
    151     'notendswith': 'NOT LIKE BINARY %s', 
    152     'inotcontains': 'NOT LIKE %s', 
    153     'inotstartswith': 'NOT LIKE %s', 
    154     'inotendswith': 'NOT LIKE %s', 
    155149} 
    156150 
  • django/trunk/django/core/db/backends/postgresql.py

    r1534 r1541  
    152152    'istartswith': 'ILIKE %s', 
    153153    'iendswith': 'ILIKE %s', 
    154     'notcontains': 'NOT LIKE %s', 
    155     'notstartswith': 'NOT LIKE %s', 
    156     'notendswith': 'NOT LIKE %s', 
    157     'inotcontains': 'NOT ILIKE %s', 
    158     'inotstartswith': 'NOT ILIKE %s', 
    159     'inotendswith': 'NOT ILIKE %s', 
    160154} 
    161155 
  • django/trunk/django/core/db/backends/sqlite3.py

    r1534 r1541  
    154154    'istartswith': "LIKE %s ESCAPE '\\'", 
    155155    'iendswith': "LIKE %s ESCAPE '\\'", 
    156     'notcontains': "NOT LIKE %s ESCAPE '\\'", 
    157     'notstartswith': "NOT LIKE %s ESCAPE '\\'", 
    158     'notendswith': "NOT LIKE %s ESCAPE '\\'", 
    159     'inotcontains': "NOT LIKE %s ESCAPE '\\'", 
    160     'inotstartswith': "NOT LIKE %s ESCAPE '\\'", 
    161     'inotendswith': "NOT LIKE %s ESCAPE '\\'", 
    162156} 
    163157 
  • django/trunk/django/core/meta/fields.py

    r1534 r1541  
    182182        elif lookup_type == 'year': 
    183183            return ['%s-01-01' % value, '%s-12-31' % value] 
    184         elif lookup_type in ('contains', 'icontains', 'notcontains', 'inotcontains'): 
     184        elif lookup_type in ('contains', 'icontains'): 
    185185            return ["%%%s%%" % prep_for_like_query(value)] 
    186186        elif lookup_type == 'iexact': 
    187187            return [prep_for_like_query(value)] 
    188         elif lookup_type in ('startswith', 'istartswith', 'notstartswith', 'inotstartswith'): 
     188        elif lookup_type in ('startswith', 'istartswith'): 
    189189            return ["%s%%" % prep_for_like_query(value)] 
    190         elif lookup_type in ('endswith', 'iendswith', 'notendswith', 'inotendswith'): 
     190        elif lookup_type in ('endswith', 'iendswith'): 
    191191            return ["%%%s" % prep_for_like_query(value)] 
    192192        elif lookup_type == 'isnull': 
  • django/trunk/docs/db-api.txt

    r1536 r1541  
    153153The DB API supports the following lookup types: 
    154154 
    155     =============  ============================================================== 
    156     Type           Description 
    157     =============  ============================================================== 
    158     exact          Exact match: ``polls.get_object(id__exact=14)``. 
    159     iexact         Case-insensitive exact match: 
    160                    ``polls.get_list(slug__iexact="foo")`` matches a slug of 
    161                    ``foo``, ``FOO``, ``fOo``, etc. 
    162     contains       Case-sensitive containment test: 
    163                    ``polls.get_list(question__contains="spam")`` returns all polls 
    164                    that contain "spam" in the question. (PostgreSQL and MySQL 
    165                    only. SQLite doesn't support case-sensitive LIKE statements; 
    166                    ``contains`` will act like ``icontains`` for SQLite.) 
    167     notcontains    negated ``contains`` 
    168     icontains      Case-insensitive containment test. 
    169     inotcontains   negated ``icontains`` 
    170     gt             Greater than: ``polls.get_list(id__gt=4)``. 
    171     gte            Greater than or equal to. 
    172     lt             Less than. 
    173     lte            Less than or equal to. 
    174     ne             Not equal to. 
    175     in             In a given list: ``polls.get_list(id__in=[1, 3, 4])`` returns 
    176                    a list of polls whose IDs are either 1, 3 or 4. 
    177     startswith     Case-sensitive starts-with: 
    178                    ``polls.get_list(question_startswith="Would")``. (PostgreSQL 
    179                    and MySQL only. SQLite doesn't support case-sensitive LIKE 
    180                    statements; ``startswith`` will act like ``istartswith`` for 
    181                    SQLite.) 
    182     notstartswith  negated ``startswith`` 
    183     endswith       Case-sensitive ends-with. (PostgreSQL and MySQL only.) 
    184     notendswith    negated ``endswith`` 
    185     istartswith    Case-insensitive starts-with. 
    186     inotstartswith negated ``istartswith`` 
    187     iendswith      Case-insensitive ends-with. 
    188     inotendswith   negated ``iendswith`` 
    189     range          Range test: 
    190                    ``polls.get_list(pub_date__range=(start_date, end_date))`` 
    191                    returns all polls with a pub_date between ``start_date`` 
    192                    and ``end_date`` (inclusive). 
    193     year           For date/datetime fields, exact year match: 
    194                    ``polls.get_count(pub_date__year=2005)``. 
    195     month          For date/datetime fields, exact month match. 
    196     day            For date/datetime fields, exact day match. 
    197     isnull         True/False; does is IF NULL/IF NOT NULL lookup: 
    198                    ``polls.get_list(expire_date__isnull=True)``. 
    199     =============  ============================================================== 
     155    ===========  ============================================================== 
     156    Type         Description 
     157    ===========  ============================================================== 
     158    exact        Exact match: ``polls.get_object(id__exact=14)``. 
     159    iexact       Case-insensitive exact match: 
     160                 ``polls.get_list(slug__iexact="foo")`` matches a slug of 
     161                 ``foo``, ``FOO``, ``fOo``, etc. 
     162    contains     Case-sensitive containment test: 
     163                 ``polls.get_list(question__contains="spam")`` returns all polls 
     164                 that contain "spam" in the question. (PostgreSQL and MySQL 
     165                 only. SQLite doesn't support case-sensitive LIKE statements; 
     166                 ``contains`` will act like ``icontains`` for SQLite.) 
     167    icontains    Case-insensitive containment test. 
     168    gt           Greater than: ``polls.get_list(id__gt=4)``. 
     169    gte          Greater than or equal to. 
     170    lt           Less than. 
     171    lte          Less than or equal to. 
     172    ne           Not equal to. 
     173    in           In a given list: ``polls.get_list(id__in=[1, 3, 4])`` returns 
     174                 a list of polls whose IDs are either 1, 3 or 4. 
     175    startswith   Case-sensitive starts-with: 
     176                 ``polls.get_list(question_startswith="Would")``. (PostgreSQL 
     177                 and MySQL only. SQLite doesn't support case-sensitive LIKE 
     178                 statements; ``startswith`` will act like ``istartswith`` for 
     179                 SQLite.) 
     180    endswith     Case-sensitive ends-with. (PostgreSQL and MySQL only.) 
     181    istartswith  Case-insensitive starts-with. 
     182    iendswith    Case-insensitive ends-with. 
     183    range        Range test: 
     184                 ``polls.get_list(pub_date__range=(start_date, end_date))`` 
     185                 returns all polls with a pub_date between ``start_date`` 
     186                 and ``end_date`` (inclusive). 
     187    year         For date/datetime fields, exact year match: 
     188                 ``polls.get_count(pub_date__year=2005)``. 
     189    month        For date/datetime fields, exact month match. 
     190    day          For date/datetime fields, exact day match. 
     191    isnull       True/False; does is IF NULL/IF NOT NULL lookup: 
     192                 ``polls.get_list(expire_date__isnull=True)``. 
     193    ===========  ============================================================== 
    200194 
    201195Multiple lookups are allowed, of course, and are translated as "AND"s::