如何使用 django-south 从 django-imagekit 迁移包含 ImageField 的模型?

发布于 2024-09-15 07:12:04 字数 206 浏览 1 评论 0原文

我发现这个文档非常令人困惑: http://south.aeracode.org/docs/customfields.html

如果有人可以请引导我完成这个过程,或者至少给出一个完整的例子,我将非常感激。

I find this documentation extremely confusing:
http://south.aeracode.org/docs/customfields.html

If someone could walk me through this or at least give a full example, I would be very grateful.

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

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

发布评论

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

评论(1

累赘 2024-09-22 07:12:04

大多数时候,您只需要在使用自定义字段时执行类似的操作(例如使用 sorl.thumbnail 中的 ImageWithThumbnailsField):

# models.py
from south.modelsinspector import add_introspection_rules

add_introspection_rules([], ["^sorl\.thumbnail\.fields\.ImageWithThumbnailsField"])

来自 South 文档:如果您的自定义字段继承自核心 Django 字段,或其他字段已经有内省规则,并且它没有添加任何新属性,那么您可能不必为它添加任何规则,因为它将继承其父级的所有规则。

Most of the time, you just need to do something like this when using a custom field (example using the ImageWithThumbnailsField from sorl.thumbnail):

# models.py
from south.modelsinspector import add_introspection_rules

add_introspection_rules([], ["^sorl\.thumbnail\.fields\.ImageWithThumbnailsField"])

From the South docs: If your custom field inherits from a core Django field, or another field for which there are already introspection rules, and it doesn’t add any new attributes, then you probably won’t have to add any rules for it, as it will inherit all those from its parents.

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