Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

force_unicode

  • Loading branch information...
commit 5211fbd0b41dfb5fc3cd056e5800fe969e79fb67 1 parent 8807cb4
Arvid Paeglit authored
Showing with 4 additions and 6 deletions.
  1. +4 −6 src/haystack_snippet/views.py
View
10 src/haystack_snippet/views.py
@@ -45,10 +45,10 @@ def get_results(self):
Returns an empty list if there's no query to search with.
"""
- if not (self.form.is_valid() and self.form.cleaned_data['q']):
- return self.form.no_query_found()
+ query = self.query
- query = self.form.cleaned_data['q']
+ if not (self.form.is_valid() and query):
+ return self.form.no_query_found()
#Replace letter ё --> е
query = replace_special(query)
@@ -62,9 +62,7 @@ def get_results(self):
translited_query = force_unicode(translify(query))
detranslited_query = force_unicode(detranslify(query))
- sqs = self.searchqueryset().filter(SQ(content=detranslited_query)
- | SQ(content=translited_query)
- | SQ(content=query))
+ sqs = self.searchqueryset().filter_and(SQ(content=detranslited_query) | SQ(content=translited_query) | SQ(content=query))
#sqs = self.searchqueryset().auto_query(query)
Please sign in to comment.
Something went wrong with that request. Please try again.