Django 管理员删除 m2m 内联?
我将 Django 管理与 Grappelli 应用程序结合使用,通过带有内联表单部分的中介模型来管理 M2M 关系(图库 - 图像)。
我已成功添加包含多个图像的图库记录,但是当我返回并编辑记录时,我无法删除任何内嵌图像。
我设法消除这种关系的唯一方法是单独删除图像记录。
简单地清空字段并保存会引发验证错误(即该字段是必需的等)。我想要做的就是完全删除一个或多个内联表单部分。
有人可以帮忙吗?
任何建议表示赞赏。
I am using the Django admin with the Grappelli app to manage an M2M relationship (Gallery - Image) with an intermediary model with inline form sections.
I've added a gallery record with multiple images successfully, however when I go back and edit the record, I cannot remove any of the inline images.
The only way I have managed to remove the relationship is by deleting the image record separately.
Simply emptying the fields and saving throws up validation errors (ie This field is required etc). All I want to do is remove one or more inline form sections in its entirety.
Can anyone help?
Any advice appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
每个内联应该有一个复选框来删除它。
如果您看不到删除复选框,则您的用户可能没有删除中间模型的权限。
There should be a checkbox for each inline to delete it.
If you can't see the delete checkboxes, then perhaps your user does not have the permission to delete the intermediary model.