如何限制外键下拉? [英] how to limit the foreignkey dropdown with constraints?

查看:145
本文介绍了如何限制外键下拉?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个跟踪两个不同团队之间交互的数据库(在管理界面中由两个不同的组表示)。对于某些字段,我有一个外键到Users数据库,我想将下拉列表限制在特定的组。



如果有人有任何建议,那将是非常感谢!

解决方案

p>您正在寻找 limit_choices_to


I have a database which keeps track of interaction between two different teams (represented in the admin interface by two different groups). For some fields, i have a foreignkey to Users database, and i would like to limit the dropdown people to only the specific groups.

If anyone have any suggestions, it would be much appreciated!

解决方案

You're looking for limit_choices_to.

这篇关于如何限制外键下拉?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆