Skip to content

Instantly share code, notes, and snippets.

@ikks
Created February 11, 2012 00:03
Show Gist options
  • Save ikks/1794257 to your computer and use it in GitHub Desktop.
Save ikks/1794257 to your computer and use it in GitHub Desktop.
Sample Search Form to avoid accents using translit
from haystack.forms import SearchForm
.
.
class RtSearchForm(SearchForm):
def search(self):
if hasattr(self,'cleaned_data') and self.cleaned_data['q']:
self.cleaned_data['q']=self.cleaned_data['q'].encode('translit/one/ascii', 'replace')
sqs = super(RtSearchForm, self).search()
return sqs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment