Ticket #3689: sqlite2.diff

File sqlite2.diff, 2.1 KB (added by Nebojsa Djordjevic <nesh@…>, 17 years ago)

whoops, old patch

  • django/db/models/fields/__init__.py

     
    219219                value = int(value)
    220220            except ValueError:
    221221                raise ValueError("The __year lookup type requires an integer argument")
    222             return ['%s-01-01 00:00:00' % value, '%s-12-31 23:59:59.999999' % value]
     222            return ['%s-01-01' % value, '%s-1-1' % (value + 1)]
    223223        raise TypeError("Field has invalid lookup: %s" % lookup_type)
    224224
    225225    def has_default(self):
  • django/db/backends/sqlite3/base.py

     
    233233    'istartswith': "LIKE %s ESCAPE '\\'",
    234234    'iendswith': "LIKE %s ESCAPE '\\'",
    235235}
    236 
  • tests/regressiontests/datatypes/models.py

     
    5656datetime.time(5, 30)
    5757>>> d3.consumed_at
    5858datetime.datetime(2007, 4, 20, 16, 19, 59)
     59
     60# SQLite date bug -- ref #3689
     61# cleanup
     62>>> d.delete()
     63>>> d2.delete()
     64>>> d3.delete()
     65
     66>>> d = Donut(name='Date Test 2007', baked_date=datetime.datetime(year=2007, month=12, day=31), consumed_at=datetime.datetime(year=2007, month=12, day=31, hour=23, minute=59, second=59))
     67>>> d.save()
     68>>> d1 = Donut(name='Date Test 2006', baked_date=datetime.datetime(year=2006, month=1, day=1), consumed_at=datetime.datetime(year=2006, month=1, day=1))
     69>>> d1.save()
     70
     71>>> Donut.objects.get(baked_date__year=2007)
     72<Donut: Date Test 2007>
     73
     74>>> Donut.objects.get(baked_date__year=2006)
     75<Donut: Date Test 2006>
     76
     77>>> Donut.objects.get(consumed_at__year=2007)
     78<Donut: Date Test 2007>
     79
     80>>> Donut.objects.get(consumed_at__year=2006)
     81<Donut: Date Test 2006>
     82
     83>>> d.delete()
     84>>> d1.delete()
    5985"""}
Back to Top