在 Django 1.1 中使用什么来标记
除非我遗漏了一些东西,否则 django-tagging (0.3) 似乎在 Django 1.1.x 上不起作用。我遇到了问题,然后四处寻找,这似乎是普遍共识。
其他人用什么?以防万一,这就是我所做的一切。
class Article(models.Model):
title = models.CharField(max_length=200)
tags = TagField()
tagging.register(Article)
class ArticleAdmin(admin.ModelAdmin)
fieldsets = (
(None, { 'fields': ('title', 'tags',) }),
admin.site.register(Article, ArticleAdmin)
我有一个添加了一堆标签的脚本,它们在数据库中没有问题。但如果我访问管理员,我会得到
Tags: [
我不需要高级功能。我只想有一个管理字段,我可以在其中输入标签,进行一些基于标签的相关搜索,而不是其他很多。就是这样。
谢谢
Unless I'm missing something, it seems django-tagging (0.3) doesnt work on Django 1.1.x. I was having issues then search around and it seems to be the general concensious.
What are other people using? Just in case here is all I'm doing.
class Article(models.Model):
title = models.CharField(max_length=200)
tags = TagField()
tagging.register(Article)
class ArticleAdmin(admin.ModelAdmin)
fieldsets = (
(None, { 'fields': ('title', 'tags',) }),
admin.site.register(Article, ArticleAdmin)
I have a script that added a bunch of tags and they are in the DB without issue. But if I visit the admin, I get
Tags: [<Tag: []>]
I don't need advanced features. I just want to have an admin field where I can type in tags, to some related searches based on tags not a whole lot else. Thats about it.
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我最近使用 django-batch-select 编写了这个模式,看一下。显然,您仍然需要编写管理方面的代码,但这应该不会太困难。
I coded up this pattern recently using django-batch-select, take a look. Obviously you'll still need to code up the admin side of things but it shouldn't be too difficult.