Changeset 9466
- Timestamp:
- 11/16/08 02:48:24 (2 months ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
django/trunk/django/db/backends/sqlite3/base.py
r9060 r9466 102 102 103 103 class DatabaseWrapper(BaseDatabaseWrapper): 104 104 105 105 # SQLite requires LIKE statements to include an ESCAPE clause if the value 106 106 # being escaped has a percent or underscore in it. … … 125 125 def __init__(self, *args, **kwargs): 126 126 super(DatabaseWrapper, self).__init__(*args, **kwargs) 127 127 128 128 self.features = DatabaseFeatures() 129 129 self.ops = DatabaseOperations() … … 180 180 181 181 def _sqlite_extract(lookup_type, dt): 182 if dt is None: 183 return None 182 184 try: 183 185 dt = util.typecast_timestamp(dt) django/trunk/tests/regressiontests/model_regress/models.py
r8782 r9466 28 28 29 29 class Party(models.Model): 30 when = models.DateField( )30 when = models.DateField(null=True) 31 31 32 32 class Event(models.Model): … … 94 94 [datetime.date(1998, 12, 31)] 95 95 96 # Date filtering was failing with NULL date values in SQLite (regression test 97 # for #3501, amongst other things). 98 >>> _ = Party.objects.create() 99 >>> p = Party.objects.filter(when__month=1)[0] 100 >>> p.when 101 datetime.date(1999, 1, 1) 102 >>> l = Party.objects.filter(pk=p.pk).dates("when", "month") 103 >>> l[0].month == 1 104 True 105 96 106 # Check that get_next_by_FIELD and get_previous_by_FIELD don't crash when we 97 107 # have usecs values stored on the database
