2
我有一個分類模式和視頻模式只計算上發佈的視頻
Category:
name=Charfield()
Video:
name=CharField()
category=ManyToManyField()
is_live=BooleanField()
而且我希望有獲得所有類別與視頻計數,但我想排除誰不實時視頻。 這是我的開始狀態:
Category.objects.annotate(video_count=Count('video'))
# I tried this but I'm not sure if this the right way
Category.objects.exclude(video__is_liive=False)
任何想法?