I am using class based views in Django. @login_required decorator is not redirecting to login page. It still shows the profile page.
class ProfileView(TemplateView):
template_name='profile.html'
@login_required(login_url='/accounts/login/')
def dispatch(self, *args, **kwargs):
return super(ProfileView, self).dispatch(*args, **kwargs)
Can anyone help me. I m new to Django and any help would be appreciated.
Thanks in advance