diff --git a/django/db/models/sql/compiler.py b/django/db/models/sql/compiler.py index 38806e7dc2..98b953937f 100644 --- a/django/db/models/sql/compiler.py +++ b/django/db/models/sql/compiler.py @@ -1083,8 +1083,8 @@ class SQLDateTimeCompiler(SQLCompiler): if settings.USE_TZ: if datetime is None: raise ValueError("Database returned an invalid value " - "in QuerySet.dates(). Are time zone " - "definitions and pytz installed?") + "in QuerySet.datetimes(). Are time zone " + "definitions for your database and pytz installed?") datetime = datetime.replace(tzinfo=None) datetime = timezone.make_aware(datetime, self.query.tzinfo) yield datetime