[英]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.