如何在 Django 管理更改列表模板上添加带有下拉列表的列?
我有一个 TaskRequest 模型,其中包含名为“owner”的列。此列包含来自名为“owners”的组的用户。
我希望有一个选项可以直接从更改列表视图中选择用户,而无需单击任务名称。
如何实现下拉列表,使其在 TaskRequest 应用程序的表格中可见。我真的需要覆盖管理模板还是有其他方法可以做到这一点?
I have a TaskRequest model that contains a column named 'owner'. This column contains users from a group named 'owners'.
I want to have an option to select users directly from the change list view without clicking on the task name.
How can I implement a drop-down list so it is visible in the table in my TaskRequest app. Do I really need to overwrite the admin template or is another way to do that?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
好的,感谢@SolarissMole我设法实现了所需的目标。在Admin.py中,您只需要添加
list_ediate =(“所有者”,)
。Ok thanks to @solarissmole I managed to achieve what I needed. In admin.py you just need to put
list_editable = ("owner",)
.