My code is like this :
def check(request):
if(success):
#nothing should do
if(fail):
return HttpResponseRedirect("http://google.com")
def index(request):
return check(request)
#some other taskshere after checking login
I read in other posts that in order to make HttpResponseRedirect work, we have to return it while calling , like :
return check(request)
when login fails, its ok , but when login is success the method check is not returning anything, so giving error that index method didnt return an HttpResponse Object . Whats the solution ?
Thanks
Use the auth decorators for this.
https://docs.djangoproject.com/en/dev/topics/auth/#the-login-required-decorator
If you simply must, there are a variety of ways. You could do it as you describe: