File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -231,7 +231,18 @@ def resolve_field(model_field, lookup_expr):
231
231
232
232
def handle_timezone (value , is_dst = None ):
233
233
if settings .USE_TZ and timezone .is_naive (value ):
234
- if django .VERSION < (5 , 0 ):
234
+ # Pre-4.x versions of Django have is_dst. Later Django versions have
235
+ # zoneinfo where the is_dst argument has no meaning. is_dst will be
236
+ # removed in the 5.x series.
237
+ #
238
+ # On intermediate versions, the default is to use zoneinfo, but pytz
239
+ # is still available under USE_DEPRECATED_PYTZ, and is_dst is
240
+ # meaningful there. Under those versions we should only use is_dst
241
+ # if USE_DEPRECATED_PYTZ is present and True; otherwise, we will cause
242
+ # deprecation warnings, and we should not. See #1580.
243
+ #
244
+ # This can be removed once 3.2 is no longer supported upstream.
245
+ if django .VERSION < (4 , 0 ) or (django .VERSION < (5 , 0 ) and settings .USE_DEPRECATED_PYTZ ):
235
246
return timezone .make_aware (value , timezone .get_current_timezone (), is_dst )
236
247
return timezone .make_aware (value , timezone .get_current_timezone ())
237
248
elif not settings .USE_TZ and timezone .is_aware (value ):
You can’t perform that action at this time.
0 commit comments