diff --git a/django/db/models/fields/__init__.py b/django/db/models/fields/__init__.py index 4a47997ae9d..088d375e574 100644 --- a/django/db/models/fields/__init__.py +++ b/django/db/models/fields/__init__.py @@ -230,9 +230,14 @@ class Field(object): raise ValueError("The __year lookup type requires an integer argument") if settings.DATABASE_ENGINE == 'sqlite3': first = '%s-01-01' + second = '%s-12-31 23:59:59.999999' + elif settings.DATABASE_ENGINE == 'oracle' and self.get_internal_type() == 'DateField': + first = '%s-01-01' + second = '%s-12-31' else: first = '%s-01-01 00:00:00' - return [first % value, '%s-12-31 23:59:59.999999' % value] + second = '%s-12-31 23:59:59.999999' + return [first % value, second % value] raise TypeError("Field has invalid lookup: %s" % lookup_type) def has_default(self):