silentsokolov/django-admin-rangefilter

Using `settings.USE_TZ = False` on django4.0+ results in error

Closed this issue · 1 comments

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.".

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 where tzinfo is always added as a kwarg under 4.0+, while under previous djangos settings.USE_TZ would need to be truthy for the value to be changed. If I override make_dt_aware to bypass it and just return the value the tests pass again.

Thx, fixed on 0.8.8