django-selectable icon indicating copy to clipboard operation
django-selectable copied to clipboard

Better Handling of Multiple Lookup Fields

Open mlavin opened this issue 12 years ago • 6 comments

With support for multiple lookup fields there are some improvements that could probably be made in the ModelLookup. For instance if you are looking up a User based on first name and last name and search "John Doe" you won't find them because it searches for users with the first name "John Doe" or last name "John Doe" which is clearly not the desired behavior. How to tokenize the search term (in this case we want it by spaces) and how to combine the terms (OR vs AND) will likely need to be configurable.


  • Bitbucket: https://bitbucket.org/mlavin/django-selectable/issue/57
  • Originally Reported By: Mark Lavin
  • Originally Created At: 2012-06-02T03:33:47.699

mlavin avatar Nov 10 '13 01:11 mlavin

0.7 is focusing on client side changes (and there a lot) so this is getting bumped.


Original Comment By: Mark Lavin

mlavin avatar Nov 10 '13 01:11 mlavin

This seems like a good candidate for the next set of features.


Original Comment By: Mark Lavin

mlavin avatar Nov 10 '13 01:11 mlavin

Ah yes, shlex.split looks like it will make the search even more useful.


Original Comment By: Simeon Walker

mlavin avatar Nov 10 '13 01:11 mlavin

Thanks @simbloke! This looks pretty good. I might change this to use shlex.split so that quoted terms are not split.


Original Comment By: Mark Lavin

mlavin avatar Nov 10 '13 01:11 mlavin

I recently came across this whilst using selectable to so a person lookup. I solved it by using the basic query from grappelli, see attachment.


Original Comment By: Simeon Walker

mlavin avatar Nov 10 '13 01:11 mlavin

Are there a documentation to handling of multiple lookup fields?

pije76 avatar Aug 07 '20 09:08 pije76