简体   繁体   English

如何将操作应用于list_filter中的多个项目,而不必一个接一个地单独执行?

[英]How can I apply an action to multiple items in a list_filter, without having to do them individually, one after the other?

Say i have in django admin, 说我在django管理员中,

list_filters = ['car_number'] list_filters = ['car_number']

It will give me a list of the car numbers that are in the model for me to choose from one by one. 它将给我列出模型中的车号列表,我可以一一选择。

What I want to do is apply an action to multiple 'car_number's but before I can do that i have to have them visually listed so that I can click the little check box, go to my list of actions and apply the action. 我想做的是将一个动作应用于多个“ car_number”,但在此之前,我必须直观地列出它们,以便我可以单击小复选框,转到我的动作列表并应用该动作。

If you have car instances with car_number fields populated from 1-10 and you choose number 6 from the filter list, any car with that number will show up and after it does you can apply an action. 如果您有car_number字段填充为1-10的汽车实例,并且从过滤器列表中选择了数字6,则将显示具有该数字的任何汽车,并且您可以执行操作。 But I want to apply an action to both number 6 & 4 without having to do them individually one after the other. 但是我想对数字6和4都执行一个操作,而不必一个接一个地处理它们。 How can I go about this? 我该怎么办? is there a way to search for them both at the same time? 有没有办法同时搜索它们? a way to do multiple sections in the filter list? 一种方法来做多个部分的过滤器列表?

Just in case it makes a difference, I am running django suit on top of admin 以防万一它有所作为,我在管理员之上运行django suit

import numpy
cars = numpy.array([1,2,3,4,5,6]])
map(action,cars[:,[4,6]])

maybe? 也许?

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何使用list_filter在django admin中按同一字段的多个值进行过滤? - How can in filter by more than one value of same field at django admin using list_filter? 我可以从 .py 文件中调用多个函数而不必单独导入每个函数吗? - Can I call multiple functions from a .py file without having to import each one individually? Python:如何按字符串过滤列,而不必单独输入每个字符串? - Python: How can I filter columns by strings without having to enter each string individually? 如何在 list_filter django 中添加搜索框? - how can i add a search box inside list_filter django? 如何将过滤器功能应用于多个列表中的项目? - how to apply filter function to items in multiple list? Python:如何在不单独打印每条消息的情况下将消息写到列表中的项目? - Python: How do I write a message to items in a list without printing each message individually? 如何单独打印python中另一个列表中的列表项 - How do I individually print items of a list that are in another list in python setuptools setup.py 可以定义多个包吗?我如何单独引用它们? - Can setuptools setup.py define multiple packages and how do I reference them individually? 如何从列表中过滤项目并将其存储在另一个列表中? - How do I filter items from a list and store them in another list? 如何在python中将一个列表中的项匹配到另一个列表? - How can I match items from one list to the other in python?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM