[Django]-Django haystack – using a generic Views function to do search

4👍

The search_view_factory returns a view function instead of an HttpResponse, you need to invoke it properly.

def search(request):
    sqs = SearchQuerySet().all()
    view = search_view_factory(
        view_class=SearchView,
        template='search/search.html',
        searchqueryset=sqs,
        form_class=HighlightedSearchForm
        )
    return view(request)

Sorry for misleading in your previous question, I’ve fixed it also.

👤okm

Leave a comment