[1.6.x] Fixed typo and slightly improved error message when db is missing time zone definitions.

Refs #21432.

Backport of 32e75803be from master
This commit is contained in:
Loic Bistuer 2013-11-15 10:55:29 +07:00 committed by Tim Graham
parent 0e8138349e
commit 3bb7de8c7c
1 changed files with 2 additions and 2 deletions

View File

@ -1105,8 +1105,8 @@ class SQLDateTimeCompiler(SQLCompiler):
if settings.USE_TZ: if settings.USE_TZ:
if datetime is None: if datetime is None:
raise ValueError("Database returned an invalid value " raise ValueError("Database returned an invalid value "
"in QuerySet.dates(). Are time zone " "in QuerySet.datetimes(). Are time zone "
"definitions and pytz installed?") "definitions for your database and pytz installed?")
datetime = datetime.replace(tzinfo=None) datetime = datetime.replace(tzinfo=None)
datetime = timezone.make_aware(datetime, self.query.tzinfo) datetime = timezone.make_aware(datetime, self.query.tzinfo)
yield datetime yield datetime