The Auditlog extension works fine in my testing on SQLite and Postgres, but on MySQL navigating to the admin screen throws an exception: "Database returned an invalid datetime value. Are time zone definitions for your database installed?"
"GET .../admin/advanced_filters/advancedfilter/"
web_1 | ERROR Internal Server Error: /admin/auditlog/logentry/
web_1 | Traceback (most recent call last):
web_1 | File "/app/lib/python3.12/site-packages/django/core/handlers/exception.py", line 55, i
web_1 | ^^^^^^^^^^^^^^^^^^^^^
web_1 | File "/app/lib/python3.12/site-packages/django/template/response.py", line 92, in rendered_content
web_1 | return template.render(context, self._request)
web_1 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
web_1 | File "/app/lib/python3.12/site-packages/django/template/backends/django.py", line 107, in render
web_1 | return self.template.render(context)
web_1 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
web_1 | File "/app/lib/python3.12/site-packages/django/template/base.py", line 171, in render
web_1 | return self._render(context)
web_1 | ^^^^^^^^^^^^^^^^^^^^^
...
web_1 | File "/app/lib/python3.12/site-packages/django/contrib/admin/templatetags/admin_list.py", line 438, in date_hierarchy
web_1 | for day in days
web_1 | ^^^^
web_1 | File "/app/lib/python3.12/site-packages/django/db/models/query.py", line 384, in __iter__
web_1 | self._fetch_all()
web_1 | File "/app/lib/python3.12/site-packages/django/db/models/query.py", line 1949, in _fetch_all
web_1 | self._result_cache = list(self._iterable_class(self))
web_1 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
web_1 | File "/app/lib/python3.12/site-packages/django/db/models/query.py", line 271, in __iter__
web_1 | for row in compiler.results_iter(
web_1 | ^^^^^^^^^^^^^^^^^^^^^^
web_1 | File "/app/lib/python3.12/site-packages/django/db/models/sql/compiler.py", line 1541, in apply_converters
web_1 | value = converter(value, expression, connection)
web_1 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
web_1 | File "/app/lib/python3.12/site-packages/django/db/models/functions/datetime.py", line 353, in convert_value
web_1 | raise ValueError(
web_1 | ValueError: Database returned an invalid datetime value. Are time zone definitions for your database installed?
The Auditlog extension works fine in my testing on SQLite and Postgres, but on MySQL navigating to the admin screen throws an exception: "Database returned an invalid datetime value. Are time zone definitions for your database installed?"
The issue occurs when
USE_TZ = True, which is also the default setting. This leads me to believe that a fix would be in Auditlog's handling of dates. I've tried clearing the log, and the database values look correct to me.See also #403
Stack trace: