使用 django-tagging 检索特定查询集的标签
我正在使用 django 标记,并尝试检索特定查询集的标签列表。这就是我得到的:
tag = Tag.objects.get(name='tag_name')
queryset = TaggedItem.objects.get_by_model(Article, tag)
tags = Tag.objects.usage_for_queryset(queryset, counts=True)
“queryset”适当地返回许多已用标签“tag_name”标记的文章,但是当我尝试检索该查询集的所有标签时,“tags”返回所有内容的完整列表该模型的标签。
其他人以前遇到过这个问题,还是这是 django 标记中的一个错误?
I'm using django-tagging, and am trying to retrieve a list of tags for a specific queryset. Here's what I've got:
tag = Tag.objects.get(name='tag_name')
queryset = TaggedItem.objects.get_by_model(Article, tag)
tags = Tag.objects.usage_for_queryset(queryset, counts=True)
"queryset" appropriately returns a number of articles that have been tagged with the tag 'tag_name', but when I attempt to retrieve all of the tags for that queryset, "tags" returns a complete list of all tags for that model.
Anyone else run into this before, or is this a bug in django-tagging?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这似乎是 django 标记中的一个错误。补丁已经写好了,但是还没有提交到主干。在此处查找补丁:
http://code.google.com /p/django-tagging/issues/detail?id=44
This appears to be a bug in django-tagging. A patch has been written, but it has not yet been committed to trunk. Find the patch here:
http://code.google.com/p/django-tagging/issues/detail?id=44