我有这个查询来统计按月拍摄的照片。它只会返回不为0的值。我如何才能使它显示整个月份,即使它为0?
today = datetime.date.today()
6months = today - datetime.timedelta(6*365/12)
qs = Photo.objects.filter(camera__owner=self, timestamp__gte=6months).annotate(
month=ExtractMonth('timestamp'),
).values('month').annotate(
photos=Count('id')
).order_by('month')