oscarmlage / django-cruds-adminlte

django-cruds is simple drop-in django app that creates CRUD for faster prototyping
BSD 3-Clause "New" or "Revised" License
424 stars 81 forks source link

filter_list allowing __icontains and similars #118

Open Seykotron opened 4 years ago

Seykotron commented 4 years ago

Hello,

Can we add that feature? Would be nice to filter not just the exact literal, right now you cant do for example nameicontains because it checks if the attr "nameicontains" 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 commented 4 years ago

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 commented 4 years ago

I have it developed (in features) in search I also know that it works out of the box.

:) Thanks!!

El mié., 28 ago. 2019 12:56, Oscar M. Lage notifications@github.com escribió:

Hey @Seykotron https://github.com/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 :-)

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/oscarmlage/django-cruds-adminlte/issues/118?email_source=notifications&email_token=AAUFIZQDCMYXZENNDLLLOW3QGZKWBA5CNFSM4INV4PH2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD5KW7KA#issuecomment-525692840, or mute the thread https://github.com/notifications/unsubscribe-auth/AAUFIZXGW65GTWZLXZXSJD3QGZKWBANCNFSM4INV4PHQ .

oscarmlage commented 4 years ago

I have it developed

Nice!, could you please send a PR?

Seykotron commented 4 years ago

Yes, let me create a branch and paste the functionality ^^

:)

El mié., 28 ago. 2019 a las 19:15, Oscar M. Lage (notifications@github.com) escribió:

I have it developed

Nice!, could you please send a PR?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/oscarmlage/django-cruds-adminlte/issues/118?email_source=notifications&email_token=AAUFIZV6DPYKZUAZSVPPVC3QG2XCTA5CNFSM4INV4PH2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD5L2RVI#issuecomment-525838549, or mute the thread https://github.com/notifications/unsubscribe-auth/AAUFIZVSSEF4F5RYX2PRX7DQG2XCTANCNFSM4INV4PHQ .

Seykotron commented 4 years ago

I owe you time ago ;)

PR sended!! :P