Haystack Faceted: __init__() Got An Unexpected Keyword Argument 'facet_fields'
While enjoying my first results with haystack 2.4.1 (Django 1.8), I have to admit that I'm having a hard time on learning it. The documentation is sometimes incomplete, and some fe
Solution 1:
The documentation is just wrong, and confusing. You cannot pass facet_fields
to the constructor for FacetedSearchView
.
The approach you have taken is correct although rather than put all those arguments in the url
definition, you should create your own view - something like this:
# tag_analytics/views.pyfrom haystack.generic_views import FacetedSearchView as BaseFacetedSearchView
# Now create your own that subclasses the base viewclassFacetedSearchView(BaseFacetedSearchView):
form_class = FacetedSearchForm
facet_fields = ['author']
template_name = 'search.html'
context_object_name = 'page_object'# ... Any other custom methods etc
Then in urls.py
:
from tag_analytics.views import FacetedSearchView
#...
url(r'^$', FacetedSearchView.as_view(), name='haystack_search'),
Post a Comment for "Haystack Faceted: __init__() Got An Unexpected Keyword Argument 'facet_fields'"