Ticket #2993: lazydate-no-isinstance.diff
File lazydate-no-isinstance.diff, 1011 bytes (added by , 18 years ago) |
---|
-
__init__.py
459 459 # Casts dates into string format for entry into database. 460 460 if isinstance(value, datetime.datetime): 461 461 value = value.date().strftime('%Y-%m-%d') 462 elif isinstance(value, datetime.date):462 elif value is not None: 463 463 value = value.strftime('%Y-%m-%d') 464 464 return Field.get_db_prep_save(self, value) 465 465 … … 495 495 if settings.DATABASE_ENGINE == 'mysql' and hasattr(value, 'microsecond'): 496 496 value = value.replace(microsecond=0) 497 497 value = str(value) 498 elif isinstance(value, datetime.date):498 elif value is not None: 499 499 # MySQL will throw a warning if microseconds are given, because it 500 500 # doesn't support microseconds. 501 501 if settings.DATABASE_ENGINE == 'mysql' and hasattr(value, 'microsecond'):