I have a small project but I am trying to restrict access on some of the django app urls to login users only. The problem is that when I hit a page that requires login users I expected that they(users) are redirected to the login page however that is not the case of what happens instead they are redirected to an example url link like this '/login?next=/detail/1/' with an error message as stated "TypeError at /login/ object() takes no parameters"
The django project url
(r'^detail/(?P<pk>\d{1,10})/$',login_required(views.DetailViewMember.as_view)),
url(r'^login/$',views.members_login,name='login'),
The Login View Function
def members_login(request):
if request.method == 'POST':
password = request.POST['password']
username = request.POST['username']
user = authenticate(username=username,password=password)
if user is not None:
if user.is_active:
login(request,user)
return redirect('members:index') else:
#inactive users required to re-register
return redirect('members:index')#render(request,'members/login',dict(loginErr=True)) else:
#no account required to register to create one
return redirect('members:index')
else:
#test if login is a regular get request then redirect
return redirect('members:index')
Can you explain to me why is it the I am getting this error?
Thank you