使用 Django-import-export 导入空白 TextField

发布于 01-17 20:18 字数 265 浏览 5 评论 0原文

想象一下,我的数据库中存储了数据。一个模型包含一个带有blamn = true的django textfield,但根据django justnuction,没有null = true。数据是通过Admin-Menu创建的。空的文本场被存储为空字符串,效果很好。但是导入django-import-export抛出违反了无效约束细节:失败行包含。这是django-import export的问题吗?

Imagine I have data stored in my database. A model contains a Django TextField with blank=True but without null=True according to Django convention. The data were created via the admin-menu. Empty TextFields are stored as empty strings which works just fine. But import trough django-import-export throws violates not-null constraint DETAIL: Failing row contains. Is this a problem of django-import-export?

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

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

发布评论

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

评论(1

小嗷兮2025-01-24 20:18:23

如果您是从Excel导入的,则必须给出空字符串(''),而不是Excel中的空列。

If you are importing from excel, you will have to give empty string('') instead of empty columns in excel.

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