6đź‘Ť
âś…
Subclass SearchView
and override __call__
which is the “view” part of the class.
from haystack.views import SearchView
class MySearchView(SearchView):
def __call__(self, request, some_var):
self.some_var = some_var
return super(MySearchView, self).__call__(request)
Then, you can use self.some_var
in other methods on the class.
👤Chris Pratt
Source:stackexchange.com