8000 0.90-bugfixes: backport [2238]. Refs #1148 · django/django@56075c0 · GitHub
[go: up one dir, main page]

Skip to content

Commit 56075c0

Browse files
committed
0.90-bugfixes: backport [2238]. Refs #1148
git-svn-id: http://code.djangoproject.com/svn/django/branches/0.90-bugfixes@4270 bcc190cf-cafb-0310-a4f2-bffc1f526a37
1 parent 4f5fb9f commit 56075c0

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

django/core/meta/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1126,9 +1126,9 @@ def _get_where_clause(lookup_type, table_prefix, field_name, value):
11261126
pass
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':
11341134
return "%s%s IS %sNULL" % (table_prefix, field_name, (not value and 'NOT ' or ''))

django/core/meta/fields.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -157,12 +157,10 @@ def get_db_prep_save(self, value):
157157

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' 6BD5 , '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)]
168166
elif lookup_type == 'iexact':

0 commit comments

Comments
 (0)
0