我想从taggitItem表中获得每个标签的文章数;我已经写了以下代码,但它不能正常工作。
article_content_type = ContentType.objects.get_for_model(Article)
articles = TaggedItem.objects.filter(content_type = article_content_type).annotate(count = Count('tag'))请帮帮忙。
发布于 2011-06-21 17:13:19
article_count = TaggedItem.objects.filter(content_type = article_content_type).count()也许不使用TaggedItem类会更好,而是通过文章类来实现。
https://stackoverflow.com/questions/6422360
复制相似问题