While updating our project to support django4.0+ I think we've come across a bug. We specify USE_TZ= False in our settings, and the tests for a django admin class that uses DateFilter are now failing under django4.1 with the error: "ValueError: MySQL backend does not support timezone-aware datetimes when USE_TZ is False.".
While updating our project to support django4.0+ I think we've come across a bug. We specify
USE_TZ= False
in our settings, and the tests for a django admin class that usesDateFilter
are now failing under django4.1 with the error: "ValueError: MySQL backend does not support timezone-aware datetimes when USE_TZ is False.".I believe I've narrowed it down to
DateFilter.make_tz_aware
https://github.com/silentsokolov/django-admin-rangefilter/blob/v0.8.7/rangefilter/filters.py#L118:L128 wheretzinfo
is always added as a kwarg under 4.0+, while under previous djangossettings.USE_TZ
would need to be truthy for the value to be changed. If I overridemake_dt_aware
to bypass it and just return the value the tests pass again.