Ticket #10071: month_and_day_lookups_as_ints.diff

File month_and_day_lookups_as_ints.diff, 1.0 KB (added by Leo Soto M., 16 years ago)
  • django/db/backends/sqlite3/base.py

    diff -r fe29498ad607 django/db/backends/sqlite3/base.py
    a b  
    187187        dt = util.typecast_timestamp(dt)
    188188    except (ValueError, TypeError):
    189189        return None
    190     return unicode(getattr(dt, lookup_type))
     190    return getattr(dt, lookup_type)
    191191
    192192def _sqlite_date_trunc(lookup_type, dt):
    193193    try:
  • django/db/models/fields/__init__.py

    diff -r fe29498ad607 django/db/models/fields/__init__.py
    a b  
    488488        # For "__month" and "__day" lookups, convert the value to a string so
    489489        # the database backend always sees a consistent type.
    490490        if lookup_type in ('month', 'day'):
    491             return [force_unicode(value)]
     491            return [int(value)]
    492492        return super(DateField, self).get_db_prep_lookup(lookup_type, value)
    493493
    494494    def get_db_prep_value(self, value):
Back to Top