Opened 18 years ago
Closed 18 years ago
#5322 closed (duplicate)
Casting string to DateTime object does not check for existence of strftime.
| Reported by: | Owned by: | nobody | |
|---|---|---|---|
| Component: | contrib.admin | Version: | dev | 
| Severity: | Keywords: | ||
| Cc: | Triage Stage: | Unreviewed | |
| Has patch: | yes | Needs documentation: | no | 
| Needs tests: | no | Patch needs improvement: | no | 
| Easy pickings: | no | UI/UX: | no | 
Description
Similar to #2192
patch :
Index: __init__.py
===================================================================
--- __init__.py (revision 6022)
+++ __init__.py (working copy)
@@ -534,7 +534,7 @@
 
     def get_db_prep_save(self, value):
         # Casts dates into string format for entry into database.
-        if value is not None:
+        if value is not None and hasattr(value, 'strftime'):
             value = value.strftime('%Y-%m-%d')
         return Field.get_db_prep_save(self, value)
      
  Note:
 See   TracTickets
 for help on using tickets.
    
Dup of #3146, which has been fixed.