def basic_search(request, template=u'search/search.html', load_all=True, form_class=ModelSearchForm, searchqueryset=None, extra_context=None, results_per_page=None):
 query = u''
 results = EmptySearchQuerySet()
 if request.GET.get(u'q'):
  form = form_class(request.GET, searchqueryset=searchqueryset, load_all=load_all)
  if form.is_valid():
   query = form.cleaned_data[u'q']
   results = form.search()
 else:
  form = form_class(searchqueryset=searchqueryset, load_all=load_all)
 paginator = Paginator(results, (results_per_page or RESULTS_PER_PAGE))
 try:
  page = paginator.page(int(request.GET.get(u'page', 1)))
 except InvalidPage:
  raise Http404(u'No such page of results!')
 context = {u'form': form, u'page': page, u'paginator': paginator, u'query': query, u'suggestion': None}
 if results.query.backend.include_spelling:
  context[u'suggestion'] = form.get_suggestion()
 if extra_context:
  context.update(extra_context)
 return render(request, template, context)

def basic_search ( request , template = u'search/search.html' , load_all = True , form_class = ModelSearchForm , searchqueryset = None , extra_context = None , results_per_page = None ) : query = u'' results = EmptySearchQuerySet ( ) if request . GET . get ( u'q' ) : form = form_class ( request . GET , searchqueryset = searchqueryset , load_all = load_all ) if form . is_valid ( ) : query = form . cleaned_data [ u'q' ] results = form . search ( ) else : form = form_class ( searchqueryset = searchqueryset , load_all = load_all ) paginator = Paginator ( results , ( results_per_page or RESULTS_PER_PAGE ) ) try : page = paginator . page ( int ( request . GET . get ( u'page' , 1 ) ) ) except InvalidPage : raise Http404 ( u'No such page of results!' ) context = { u'form' : form , u'page' : page , u'paginator' : paginator , u'query' : query , u'suggestion' : None } if results . query . backend . include_spelling : context [ u'suggestion' ] = form . get_suggestion ( ) if extra_context : context . update ( extra_context ) return render ( request , template , context )
a more traditional view that also demonstrate an alternative way to use haystack .