Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Browse files

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

git-svn-id: bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
1 parent 4f5fb9f commit 56075c08c3bcd42a03b173aaed48af238393be12 @ubernostrum ubernostrum committed
Showing with 3 additions and 5 deletions.
  1. +2 −2 django/core/meta/
  2. +1 −3 django/core/meta/
4 django/core/meta/
@@ -1126,9 +1126,9 @@ def _get_where_clause(lookup_type, table_prefix, field_name, value):
if lookup_type == 'in':
return '%s%s IN (%s)' % (table_prefix, field_name, ','.join(['%s' for v in value]))
- elif lookup_type in ('range', 'year'):
+ elif lookup_type == 'range':
return '%s%s BETWEEN %%s AND %%s' % (table_prefix, field_name)
- elif lookup_type in ('month', 'day'):
+ elif lookup_type in ('year', 'month', 'day'):
return "%s = %%s" % db.get_date_extract_sql(lookup_type, table_prefix + field_name)
elif lookup_type == 'isnull':
return "%s%s IS %sNULL" % (table_prefix, field_name, (not value and 'NOT ' or ''))
4 django/core/meta/
@@ -157,12 +157,10 @@ def get_db_prep_save(self, value):
def get_db_prep_lookup(self, lookup_type, value):
"Returns field's value prepared for database lookup."
- if lookup_type in ('exact', 'gt', 'gte', 'lt', 'lte', 'ne', 'month', 'day'):
+ if lookup_type in ('exact', 'gt', 'gte', 'lt', 'lte', 'ne', 'year', 'month', 'day'):
return [value]
elif lookup_type in ('range', 'in'):
return value
- elif lookup_type == 'year':
- return ['%s-01-01' % value, '%s-12-31' % value]
elif lookup_type in ('contains', 'icontains'):
return ["%%%s%%" % prep_for_like_query(value)]
elif lookup_type == 'iexact':

0 comments on commit 56075c0

Please sign in to comment.
Something went wrong with that request. Please try again.