Django 管理内联弹出窗口

发布于 2025-01-03 07:43:28 字数 763 浏览 2 评论 0原文

像这里的许多其他用户一样,我在尝试在 django 管理中使用嵌套内联表单时遇到了阻碍。

我有一个大致为

Group 的 数据结构 - 一些数据字段

巡查 - 组的外键 - 一些不同的数据字段

Scout - 巡逻的外键 - 更多数据字段

理想情况下,当我去编辑 Group 记录时,我会让管理界面显示链接到通过 StackedInlineStackedInline 显示的 scout 的 Patrol 实例code> 然后让与每个巡逻相关的 Scout 记录显示在内部 TabularInline 中,但是目前这是不可能的,我花了很多时间尝试移植到 两年前的补丁,但收效甚微。

据我所知,我有三个选择 坚持

  1. 尝试让这个很久以前的补丁发挥作用 在
  2. 没有侦察关系的情况下列出 TabularInline 中的巡逻对象并提供编辑巡逻成员链接将弹出一个表单以在新窗口中编辑巡逻。
  3. 只要保持简单,让系统用户在编辑组和巡逻之间来回切换即可。

选项 2 目前看起来最有前途,但我需要建议如何弹出一个额外的窗口来编辑巡逻。

任何建议关于如何做到这一点,如何让嵌套内联字段工作或一般的其他方式将非常感激。

Like a many other users here i have been thwarted in trying to get nested inline forms working in the django admin.

I have a data structure that is roughly

Group
- Some data fields

Patrol
- Foreign key to groups
- Some different data fields

Scout
- Foreign key to patrol
- Even more data fields

Ideally when i go to edit a Group record, i would have the admin interface present the Patrol instances linked to scout shown though StackedInline and then have the Scout records related to each of these patrols show up inside an inner TabularInline however this is not currently possible, i have spent a large amount of time trying to port over a patch from two years ago but have had little success.

As far as i see it i have three options open to me

  1. Persist with trying to get this patch from an age ago to work
  2. List patrol objects within a TabularInline without the scout relation and provide an edit patrol members link that pops up a form to edit a patrol in a new window.
  3. Just keep it simple and make users of the system go back and forth between editing group and patrols

Option 2 is what currently looks the most promising but i need advice as to how i could pop up an extra window to edit the patrol in.

Any advice on how to do this, how to get nested inline fields to work or another way in general would be much appreciated.

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

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

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文