Django

Code

Changeset 2450

Show
Ignore:
Timestamp:
02/28/06 21:17:24 (3 years ago)
Author:
adrian
Message:

Added note to mysql backend about DATE_FORMAT not working. Refs #1423

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • django/trunk/django/core/db/backends/mysql.py

    r2348 r2450  
    107107    # MySQL doesn't support DATE_TRUNC, so we fake it by subtracting intervals. 
    108108    # If you know of a better way to do this, please file a Django ticket. 
     109    # Note that we can't use DATE_FORMAT directly because that causes the output 
     110    # to be a string rather than a datetime object, and we need MySQL to return 
     111    # a date so that it's typecasted properly into a Python datetime object. 
    109112    subtractions = ["interval (DATE_FORMAT(%s, '%%%%s')) second - interval (DATE_FORMAT(%s, '%%%%i')) minute - interval (DATE_FORMAT(%s, '%%%%H')) hour" % (field_name, field_name, field_name)] 
    110113    if lookup_type in ('year', 'month'):