在 Django 1.1 中使用什么来标记

发布于 2024-08-12 05:23:56 字数 596 浏览 2 评论 0原文

除非我遗漏了一些东西,否则 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

北凤男飞 2024-08-19 05:23:56

我最近使用 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文