Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

filter_list allowing __icontains and similars #118

Open
Seykotron opened this issue Aug 20, 2019 · 5 comments
Open

filter_list allowing __icontains and similars #118

Seykotron opened this issue Aug 20, 2019 · 5 comments
Labels

Comments

@Seykotron
Copy link

Hello,

Can we add that feature? Would be nice to filter not just the exact literal, right now you cant do for example name__icontains because it checks if the attr "name__icontains" exists in the model I think we can split the string for __ and get the first part of the string to search the field.

Sorry for my english :)

@oscarmlage
Copy link
Owner

oscarmlage commented Aug 28, 2019

Hey @Seykotron.

You can add the icontains in the search out of the box. If you have an Author(name, description) model you can add the following to the CRUDView instance:

class AuthorCRUD(CRUDView):
    model = Author
    ...
    search_fields = ['name__icontains']

And it will search like the icontains in the name field. We already have that feature but for search, not for list_filter. Dunno if that could help you, other than that would be nice to have icontains in filters too.

Marked as feature :-)

@Seykotron
Copy link
Author

Seykotron commented Aug 28, 2019 via email

@oscarmlage
Copy link
Owner

I have it developed

Nice!, could you please send a PR?

@Seykotron
Copy link
Author

Seykotron commented Aug 28, 2019 via email

@Seykotron
Copy link
Author

I owe you time ago ;)

PR sended!! :P

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants