summaryrefslogtreecommitdiff
path: root/django
diff options
context:
space:
mode:
authorMalcolm Tredinnick <malcolm.tredinnick@gmail.com>2006-06-28 11:37:17 +0000
committerMalcolm Tredinnick <malcolm.tredinnick@gmail.com>2006-06-28 11:37:17 +0000
commit414bc24e81014239cc71f0b04e85622050068e9d (patch)
tree60d1d2beadd64fec33104a7366af8731895d2a8f /django
parentd6c95e93a7a6b31e68789dc586b2cfa446cf8c50 (diff)
Fixed #1754, #2211, #2192 -- allow date filtering comparisons to use strings as
well as date objects. Fixed a couple of admin crashes as well. git-svn-id: http://code.djangoproject.com/svn/django/trunk@3223 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django')
-rw-r--r--django/db/models/fields/__init__.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/django/db/models/fields/__init__.py b/django/db/models/fields/__init__.py
index bc6042ae59..8b000d3c2a 100644
--- a/django/db/models/fields/__init__.py
+++ b/django/db/models/fields/__init__.py
@@ -411,7 +411,7 @@ class DateField(Field):
def get_db_prep_lookup(self, lookup_type, value):
if lookup_type == 'range':
value = [str(v) for v in value]
- elif lookup_type in ('exact', 'gt', 'gte', 'lt', 'lte', 'ne'):
+ elif lookup_type in ('exact', 'gt', 'gte', 'lt', 'lte', 'ne') and hasattr(value, 'strftime'):
value = value.strftime('%Y-%m-%d')
else:
value = str(value)