.annotate(year=ExtractYear('create_time'),month=ExtractMonth('create_time'))\ .values('year','month').order_by('year','month').annotate(count=Count('id')) print(count_res) 打印結(jié)果: 1 <QuerySet [{'year':2018,'month':7,'count':3}, {'year':2019,'month':5,'count':7}, {'...
www.dbjr.com.cn/article/1656...htm 2025-5-21