diff custom_search/forms.py @ 1034:2f36abf65a62

Fix UnicodeEncodeError issue in custom search form.
author Brian Neal <bgneal@gmail.com>
date Sat, 26 Dec 2015 15:28:16 -0600
parents 6cc9221d04a7
children 829d3b7fc0f7
line wrap: on
line diff
--- a/custom_search/forms.py	Sat Dec 26 15:16:10 2015 -0600
+++ b/custom_search/forms.py	Sat Dec 26 15:28:16 2015 -0600
@@ -97,18 +97,18 @@
         # auto-escaped for us.
         #
         # Gather regular search terms
-        terms = ' '.join(self.cleaned_data['q'].split())
+        terms = u' '.join(self.cleaned_data['q'].split())
 
         # Exact words or phrases:
         exact = self.cleaned_data['exact'].strip()
         if exact:
-            exact = '"{}"'.format(exact)
+            exact = u'"{}"'.format(exact)
 
         # Exclude terms:
-        exclude = ["-{}".format(term) for term in self.cleaned_data['exclude'].split()]
-        exclude = ' '.join(exclude)
+        exclude = [u"-{}".format(term) for term in self.cleaned_data['exclude'].split()]
+        exclude = u' '.join(exclude)
 
-        query = ' '.join([terms, exact, exclude]).strip()
+        query = u' '.join([terms, exact, exclude]).strip()
         logger.debug("auto_query: %s", query)
 
         sqs = self.searchqueryset.auto_query(query)