组织 django-tagging 标签或为标签分配属性?

发布于 2024-09-06 18:25:44 字数 299 浏览 1 评论 0原文

我想对我的标签进行分类。这是我现在拥有的标签的示例:

css、internet-explorer、firefox、floats

其中每个都是单独的标签(显然总共 4 个)。我想将 internet-explorerfirefox 标记标记为浏览器。 django-tagging 是否提供了某种方法来执行此操作,或者我是否必须手动编辑架构?

我真的不在乎是否必须标记标签或向 tags 表添加新列,根据插件选择最简单的方法。

I'd like to categorize my tags. Here's an example of the tags I have now:

css, internet-explorer, firefox, floats

Each of those are separate tags ( 4 in total obviously ). I would like to mark the internet-explorer and firefox tags as browsers. Does django-tagging offer some sort of way for doing this or do I have to manually edit the schema?

I really don't care if I have to either tag tags or add a new column to the tags table, whichever is the easiest way in accordance with the plugin.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(1

深空失忆 2024-09-13 18:25:44

有趣的是,我也遇到了这个问题并这样解决了。
我不想弄乱 django 标记代码,因为如果我想以后升级的话会很痛苦,所以我创建了一个名为 taggingtools 的新模块。 Taggingtools 用于在管理界面中对标签进行分组和自动完成。对于分组,我创建了一个名为 TagGroup 的新模型,该模型只有一个名称。 (对于示例浏览器)。我还添加了一些函数来返回该组的标签。然后,我将浏览器的标签添加到浏览器标签组中。这样我就可以说我想要某个数据库对象的所有浏览器标签。制作它很容易,但如果您可以等待,我可以检查是否可以将其开源,这样您和其他人就不必自己构建它。

Interesting, I came across this problem as well and solved it like this.
I don't want to mess with the django-tagging code because it will be a pain if I wish to upgrade afterwards, so I made a new module called taggingtools. Taggingtools is for grouping tags and autocompletion in the admin interface. For the grouping I made a new model named TagGroup, this model just has a name. (for Example browsers). I also added some functions to return the tags for that group. I then added the tags for Browsers to the Browsers TagGroup. This way I can say I want all the browser tags for a certain database object. It's easy to make this, but if you can wait I can check if I can opensource it so you and others don't have to build it yourself.

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