Ticket #5223: sqlite_year.diff
File sqlite_year.diff, 1.3 KB (added by , 17 years ago) |
---|
-
django/db/models/fields/__init__.py
13 13 from django.core import validators 14 14 from django import oldforms 15 15 from django import newforms as forms 16 from django.core.exceptions import ObjectDoesNotExist 16 from django.core.exceptions import ObjectDoesNotExist, ImproperlyConfigured 17 17 from django.utils.functional import curry 18 18 from django.utils.itercompat import tee 19 19 from django.utils.text import capfirst … … 226 226 value = int(value) 227 227 except ValueError: 228 228 raise ValueError("The __year lookup type requires an integer argument") 229 return ['%s-01-01 00:00:00' % value, '%s-12-31 23:59:59.999999' % value] 229 try: 230 if settings.DATABASE_ENGINE == "sqlite3": 231 date_start_format = '%s-01-01' 232 else: 233 date_start_format = '%s-01-01 00:00:00' 234 except: 235 raise ImproperlyConfigured, "DATABASE_ENGINE not defined in settings.py" 236 return [date_start_format % value, '%s-12-31 23:59:59.999999' % value] 230 237 raise TypeError("Field has invalid lookup: %s" % lookup_type) 231 238 232 239 def has_default(self):