简体   繁体   中英

How do I filter the foreign keys in the django admin?

This is my admin model SubQuestion . What I want to do is to build the models or edit the admin so that it will be filtered according to the foreign keys I chose. How should I proceed?

管理员模型

You will have to use JavaScript for this purpose. Best is probably to use a module such as django-autocomplete-light in combination with select2 .

Then you will be able to filter results based on the value of other fields in the form .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM