Django

Code

Show
Ignore:
Timestamp:
02/23/08 02:36:41 (8 months ago)
Author:
mtredinnick
Message:

Fixed #3689, #5223 -- Fixed "1st of January" comparisons for SQLite without breaking the other backends.

Based on a patch from raminf and tests from Nebojsa Djordjevic.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • django/trunk/tests/regressiontests/datatypes/models.py

    r5803 r7150  
    5757>>> d3.consumed_at 
    5858datetime.datetime(2007, 4, 20, 16, 19, 59) 
     59 
     60# Year boundary tests (ticket #3689) 
     61 
     62>>> 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)) 
     63>>> d.save() 
     64>>> 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)) 
     65>>> d1.save() 
     66 
     67>>> Donut.objects.filter(baked_date__year=2007) 
     68[<Donut: Date Test 2007>] 
     69 
     70>>> Donut.objects.filter(baked_date__year=2006) 
     71[<Donut: Date Test 2006>] 
     72 
     73>>> Donut.objects.filter(consumed_at__year=2007).order_by('name') 
     74[<Donut: Apple Fritter>, <Donut: Date Test 2007>] 
     75 
     76>>> Donut.objects.filter(consumed_at__year=2006) 
     77[<Donut: Date Test 2006>] 
     78 
     79>>> Donut.objects.filter(consumed_at__year=2005) 
     80[] 
     81 
     82>>> Donut.objects.filter(consumed_at__year=2008) 
     83[] 
     84 
    5985"""}