Django 管理内联弹出窗口
像这里的许多其他用户一样,我在尝试在 django 管理中使用嵌套内联表单时遇到了阻碍。
我有一个大致为
Group 的 数据结构 - 一些数据字段
巡查 - 组的外键 - 一些不同的数据字段
Scout - 巡逻的外键 - 更多数据字段
理想情况下,当我去编辑 Group
记录时,我会让管理界面显示链接到通过 StackedInline
StackedInline 显示的 scout 的 Patrol
实例code> 然后让与每个巡逻相关的 Scout
记录显示在内部 TabularInline
中,但是目前这是不可能的,我花了很多时间尝试移植到 两年前的补丁,但收效甚微。
据我所知,我有三个选择 坚持
- 尝试让这个很久以前的补丁发挥作用 在
- 没有侦察关系的情况下列出
TabularInline
中的巡逻对象并提供编辑巡逻成员链接将弹出一个表单以在新窗口中编辑巡逻。 - 只要保持简单,让系统用户在编辑组和巡逻之间来回切换即可。
选项 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
- Persist with trying to get this patch from an age ago to work
- 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. - 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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论