Author: jacob
Date: 2007-09-14 11:48:47 -0500 (Fri, 14 Sep 2007)
New Revision: 6193
Modified:
django/trunk/AUTHORS
django/trunk/django/db/models/fields/__init__.py
Log:
Fixed #3146: DateFields no longer barf when confronted by strings. Thanks,
Deepak Thukral.
Modified: django/trunk/AUTHORS
===================================================================
--- django/trunk/AUTHORS 2007-09-14 16:44:53 UTC (rev 6192)
+++ django/trunk/AUTHORS 2007-09-14 16:48:47 UTC (rev 6193)
@@ -278,6 +278,7 @@
Frank Tegtmeyer <[EMAIL PROTECTED]>
thebjorn <[EMAIL PROTECTED]>
Zach Thompson <[EMAIL PROTECTED]>
+ Deepak Thukral <[EMAIL PROTECTED]>
[EMAIL PROTECTED]
[EMAIL PROTECTED]
Tom Tobin
Modified: django/trunk/django/db/models/fields/__init__.py
===================================================================
--- django/trunk/django/db/models/fields/__init__.py 2007-09-14 16:44:53 UTC
(rev 6192)
+++ django/trunk/django/db/models/fields/__init__.py 2007-09-14 16:48:47 UTC
(rev 6193)
@@ -538,7 +538,12 @@
def get_db_prep_save(self, value):
# Casts dates into string format for entry into database.
if value is not None:
- value = value.strftime('%Y-%m-%d')
+ try:
+ value = value.strftime('%Y-%m-%d')
+ except AttributeError:
+ # If value is already a string it won't have a strftime method,
+ # so we'll just let it pass through.
+ pass
return Field.get_db_prep_save(self, value)
def get_manipulator_field_objs(self):
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---