Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

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
  • Loading branch information...
commit 56075c08c3bcd42a03b173aaed48af238393be12 1 parent 4f5fb9f
James Bennett authored January 02, 2007
4  django/core/meta/__init__.py
@@ -1126,9 +1126,9 @@ def _get_where_clause(lookup_type, table_prefix, field_name, value):
1126 1126
         pass
1127 1127
     if lookup_type == 'in':
1128 1128
         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':
1130 1130
         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'):
1132 1132
         return "%s = %%s" % db.get_date_extract_sql(lookup_type, table_prefix + field_name)
1133 1133
     elif lookup_type == 'isnull':
1134 1134
         return "%s%s IS %sNULL" % (table_prefix, field_name, (not value and 'NOT ' or ''))
4  django/core/meta/fields.py
@@ -157,12 +157,10 @@ def get_db_prep_save(self, value):
157 157
 
158 158
     def get_db_prep_lookup(self, lookup_type, value):
159 159
         "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'):
161 161
             return [value]
162 162
         elif lookup_type in ('range', 'in'):
163 163
             return value
164  
-        elif lookup_type == 'year':
165  
-            return ['%s-01-01' % value, '%s-12-31' % value]
166 164
         elif lookup_type in ('contains', 'icontains'):
167 165
             return ["%%%s%%" % prep_for_like_query(value)]
168 166
         elif lookup_type == 'iexact':

0 notes on commit 56075c0

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