File tree Expand file tree Collapse file tree 2 files changed +11
-0
lines changed Expand file tree Collapse file tree 2 files changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -1057,6 +1057,10 @@ def results_iter(self):
10571057 # Datetimes are artifically returned in UTC on databases that
10581058 # don't support time zone. Restore the zone used in the query.
10591059 if settings .USE_TZ :
1060+ if datetime is None :
1061+ raise ValueError ("Database returned an invalid value "
1062+ "in QuerySet.dates(). Are time zone "
1063+ "definitions installed?" )
10601064 datetime = datetime .replace (tzinfo = None )
10611065 datetime = timezone .make_aware (datetime , self .query .tzinfo )
10621066 yield datetime
Original file line number Diff line number Diff line change @@ -142,6 +142,13 @@ subclass::
142142 e.g. if all the dates are in one month, it'll show the day-level
143143 drill-down only.
144144
145+ .. note::
146+
147+ ``date_hierarchy`` uses :meth:`QuerySet.datetimes()
148+ <django.db.models.query.QuerySet.datetimes>` internally. Please refer
149+ to its documentation for some caveats when time zone support is
150+ enabled (:setting:`USE_TZ = True <USE_TZ>`).
151+
145152.. attribute:: ModelAdmin.exclude
146153
147154 This attribute, if given, should be a list of field names to exclude from
You can’t perform that action at this time.
0 commit comments