Closed mweinelt closed 7 years ago
Try:
@method_decorator(login_required, name='dispatch')
That's what works on djangos generic views, but they also have a dispatch
method to decorate.
Which dispatch
method would that refer to in Watsons SearchMixin? It doesn't inherit from a basic view, and has no dispatch
method that I can see. Anyway, I tried that and it didn't work.
This should work:
from watson.views import SearchView
class LoginSearchView(LoginRequiredMixin, SearchView):
login_url = '/login/'
redirect_field_name = 'redirect_to'
template_name = 'module/search_result.html'
If it's not, then it's time to start debugging the django LoginRequiredMixin. Put print statements into it's dispatch()
method etc. django-watson does nothing that could interfere with Django authentication.
I've tried and failed to require authentication on the search view.
The search view can be used without authentication in both cases, what am I missing?