Author: ubernostrum
Date: 2007-01-02 13:47:10 -0600 (Tue, 02 Jan 2007)
New Revision: 4270

Modified:
  django/branches/0.90-bugfixes/django/core/meta/__init__.py
  django/branches/0.90-bugfixes/django/core/meta/fields.py
Log:
0.90-bugfixes: backport [2238]. Refs #1148

Modified: django/branches/0.90-bugfixes/django/core/meta/__init__.py
===================================================================
--- django/branches/0.90-bugfixes/django/core/meta/__init__.py  2006-12-30 
07:48:11 UTC (rev 4269)
+++ django/branches/0.90-bugfixes/django/core/meta/__init__.py  2007-01-02 
19:47:10 UTC (rev 4270)
@@ -1126,9 +1126,9 @@
        pass
    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 ''))

Modified: django/branches/0.90-bugfixes/django/core/meta/fields.py
===================================================================
--- django/branches/0.90-bugfixes/django/core/meta/fields.py    2006-12-30 
07:48:11 UTC (rev 4269)
+++ django/branches/0.90-bugfixes/django/core/meta/fields.py    2007-01-02 
19:47:10 UTC (rev 4270)
@@ -157,12 +157,10 @@

    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':


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Django 
updates" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to