Django

Code

Changeset 4270

Show
Ignore:
Timestamp:
01/02/07 13:47:10 (2 years ago)
Author:
ubernostrum
Message:

0.90-bugfixes: backport [2238]. Refs #1148

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • django/branches/0.90-bugfixes/django/core/meta/fields.py

    r1150 r4270  
    158158    def get_db_prep_lookup(self, lookup_type, value): 
    159159        "Returns field's value prepared for database lookup." 
    160         if lookup_type in ('exact', 'gt', 'gte', 'lt', 'lte', 'ne', 'month', 'day'): 
     160        if lookup_type in ('exact', 'gt', 'gte', 'lt', 'lte', 'ne', 'year', 'month', 'day'): 
    161161            return [value] 
    162162        elif lookup_type in ('range', 'in'): 
    163163            return value 
    164         elif lookup_type == 'year': 
    165             return ['%s-01-01' % value, '%s-12-31' % value] 
    166164        elif lookup_type in ('contains', 'icontains'): 
    167165            return ["%%%s%%" % prep_for_like_query(value)] 
  • django/branches/0.90-bugfixes/django/core/meta/__init__.py

    r1224 r4270  
    11271127    if lookup_type == 'in': 
    11281128        return '%s%s IN (%s)' % (table_prefix, field_name, ','.join(['%s' for v in value])) 
    1129     elif lookup_type in ('range', 'year')
     1129    elif lookup_type == 'range'
    11301130        return '%s%s BETWEEN %%s AND %%s' % (table_prefix, field_name) 
    1131     elif lookup_type in ('month', 'day'): 
     1131    elif lookup_type in ('year', 'month', 'day'): 
    11321132        return "%s = %%s" % db.get_date_extract_sql(lookup_type, table_prefix + field_name) 
    11331133    elif lookup_type == 'isnull':