Ticket #2031: mysql_microsecond.patch

File mysql_microsecond.patch, 789 bytes (added by jason@…, 18 years ago)
  • django/db/models/fields/__init__.py

     
    471471        # Casts dates into string format for entry into database.
    472472        if value is not None:
    473473            # MySQL will throw a warning if microseconds are given, because it
    474             # doesn't support microseconds.
    475             if settings.DATABASE_ENGINE == 'mysql':
     474            # doesn't support microsecondss.
     475            if settings.DATABASE_ENGINE == 'mysql' and hasattr(value, 'microsecond'):
    476476                value = value.replace(microsecond=0)
    477477            value = str(value)
    478478        return Field.get_db_prep_save(self, value)
Back to Top