在django admin filter list_filter中选择多个选项? [英] Selecting multiples choices in django admin filter list_filter?

查看:1545
本文介绍了在django admin filter list_filter中选择多个选项?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

目前,我通过django的管理界面中的某些选项进行过滤。例如说我按按状态进行过滤。是否可以选择多个状态来过滤结果?以下是过滤器的屏幕截图:





我可以从此列表中选择多个项目吗?

解决方案

不在管理界面中,但如果您修改URL,则可以使过滤条件更加复杂。 >

例如,现在的URL(点击过滤器之后)可能以类似于

 ?status__exact = a 

您可以将其更改为

  status__in = a%2Cm 

以查看这两种状态 a m %2C 编码逗号。


Currently i filter by some option in django's admin interface. For instance lets say i filter by 'By status'. Is it possible to select multiple statuses to filter results from? Here is the screenshot of the filter:

Can i select multiple items from this list?

解决方案

Not in the admin UI, but if you modify the URL, you can make the filtering criterion more complex.

For instance, now the URL (after you click on a filter) probably ends with something like

?status__exact=a

You can change this to

status__in=a%2Cm

in order to see both statuses a and m. The %2C encodes a comma.

这篇关于在django admin filter list_filter中选择多个选项?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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