Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Selecting multiples choices in django admin filter list_filter?

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:

http://imgur.com/tV1Nl

Can i select multiple items from this list?

like image 977
tejinderss Avatar asked Oct 20 '11 11:10

tejinderss


2 Answers

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.

like image 71
Vebjorn Ljosa Avatar answered Nov 15 '22 21:11

Vebjorn Ljosa


You can also add the following query to the URL of your list page. in my case if i have multiple option.

?bookingstatus__in=booked,refunded.
like image 28
mitcoder Avatar answered Nov 15 '22 20:11

mitcoder