如何知道 django-tagging 中是否创建了新标签?

发布于 2024-09-16 05:17:13 字数 200 浏览 2 评论 0原文

我如何知道是否为模型创建了新标签?看起来 django-tagging API 没有提供这样的方法。我是 Django 和 django 标记应用程序的新手,想听听您的建议。

更新:我想要完成的是向标签添加更多属性。我认为有另一个模型 TagProperties 链接到标签模型。每次保存标签时,我也会保存 TagProperies。

How can I know if a new tag is created for a model? Looks like the django-tagging API does not provide such method. I'm new to both Django and django-tagging app and would like to hear your advice.

Update: what I'm trying to acomplish is to add more properties to tags. I think to have another model TagProperties linked to Tag model. And every time the Tag is save I save the TagProperies as well.

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

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

发布评论

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

评论(1

清晰传感 2024-09-23 05:17:13

一种方法是使用 django 信号。您可以连接 post_save< /code>Tag 模型发出信号,并在创建新实例时处理该信号。

One way would be to use django signals. You could connect a post_save signal to the Tag model and handle that for when a new instance is created.

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