I'm a django newbie, and I just finished the tutorial (part 04), so now I want to continue and see if I can add some authentication to my project. I want to restrict access to the polls_results page, you can only see it when you're logged in. In the last part the result pages are served by a generic view (DetailView) which I subclassed and added a method decorator to the overriden dispatch method.
class VoteResults(DetailView):
@method_decorator(login_required)
def dispatch(self, *args, **kwargs):
return super(VoteResults, self).dispatch(*args, **kwargs)
Following the tutorial, after submitting my vote I expect to see an not authorized error (401?), but I still see the results page (no error) even that I'm definitely not logged in. Is there something I'm missing? All the middleware and installed apps are present in settings.py as indicated by the docs I believe.
Any clue what I'm doing wrong here?
Probably an typo in the dispatch method name. So the decorator was never hit.