Hi i have a question about django and I am afraid it is a slighty
academic question.
I am a newbie at django and I am trying to hand off control from one
view_func1 to another function ( test code below)
I am wondering why although the aunthenticate_user function i.e the
second function returns a HttpResponse object. I still need to add a
return to the calling line
i.e I dont understand why in the code below I need to say
return authenticate_user(request)
rather than just authenticate_user(request) since this function does
return an HttpResponse object.
If I dont say return authenticate_user(request) , I get a view
function does not return an HttpResponse object error even though the
authenticate_user function is getting called.
Here is the code.
Thanks
harijay
from django.http import HttpResponse
from authenticate_user import authenticate_user
def view_func1(request):
if request.user.is_authenticated():
return HttpResponse("Hello world")
else:
return authenticate_user(request)
|
|------> why is this return necessary ?
#file authenticate_user
from django.http import HttpResponse
def authenticate_user(request):
return HttpResponse("Future view function to handle
authentication")
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en.