﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
33602	date_hierarchy in admin reports an error with mysql-connector-python 8.0.28.	Eric Pan	nobody	"\site-packages\django\db\backends\mysql\operations.py  line 58
 {{{
def date_trunc_sql(self, lookup_type, field_name, tzname=None):
        field_name = self._convert_field_to_tz(field_name, tzname)
        fields = {
            'year': '%%Y-01-01',
            'month': '%%Y-%%m-01',
        }  # Use double percents to escape.

}}}
the problem is here.
{{{
   'year': '%%Y-01-01',
            'month': '%%Y-%%m-01',
}}}

this will generate the SQL.   

{{{
SELECT DISTINCT CAST(DATE_FORMAT([table name], '%%Y-01-01') AS DATE) AS `datefield
}}}

the format `''%%Y-01-01''`  is not right for mysql.

"	Bug	closed	Database layer (models, ORM)	3.2	Normal	invalid			Unreviewed	0	0	0	0	0	0
