How to include filter in query in haystack?
-
09-10-2019 - |
Question
I cant figure out whats the simplest way to pass a filter to a query set from the urls.py file without having to write a new view. I would like to be able to do something like this:
sqs = SearchQuerySet().exclude(active = False)
urlpatterns = patterns('',
.....
(r'^search/', include('haystack.urls'), {'searchqueryset':sqs}),
)
Input much appreciated!
Solution
So the reason why the filter was not working is because I was using the Simple backend, which apparently does not support that kind of filter. Problem was solved when I moved to using sorl.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow