Can anyone tell me why in the following code I get redirected to yahoo.com instead of google.com?
urls
urlpatterns = patterns('', (r'^$', initialRequest,))
view
def initialRequest(request):
if request.user.is_authenticated:
return HttpResponseRedirect('http://yahoo.com')
else:
return HttpResponseRedirect('http://google.com')
Shouldn’t it be
request.user.is_authenticated()i.e. with brackets as it’s a function?For Django 1.10 +
is_authenticatedis now an attribute (although it is being kept backwards compatible for now).