try:
    qs = qs.annotate(Year=ExtractYear('publish_date'))
except NameError:
    qs = qs.annotate(Year=RawSQL(
        "CAST(SUBSTR('table_name'.'publish_date', 1, 4) AS integer)", ()))
Get year from Django DateTimeField with values()