Skip to content

Commit

Permalink
Fix regression issue on searching where empty search query is parsed
Browse files Browse the repository at this point in the history
  • Loading branch information
rowanseymour committed Mar 3, 2017
1 parent 7f5ecc2 commit 059e26c
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions smartmin/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -645,11 +645,10 @@ def derive_queryset(self, **kwargs):

# apply any filtering
search_fields = self.derive_search_fields()
search_terms = self.request.GET.get('search', '').split(' ')
if search_fields and search_terms:

search_query = self.request.GET.get('search')
if search_fields and search_query:
term_queries = []
for term in search_terms:
for term in search_query.split(' '):
field_queries = []
for field in search_fields:
field_queries.append(Q(**{field: term}))
Expand Down

0 comments on commit 059e26c

Please sign in to comment.