Thursday, 15 January 2015

python - The view didn't return an HttpResponse object. It returned None instead -



python - The view didn't return an HttpResponse object. It returned None instead -

i have next simple view. why resulting in error?

the view auth_lifecycle.views.user_profile didn't homecoming httpresponse object. returned none instead.

"""renders web pages user-authentication-lifecycle project.""" django.shortcuts import render django.template import requestcontext django.contrib.auth import authenticate, login def user_profile(request): """displays info unique logged-in user.""" user = authenticate(username='superuserusername', password='sueruserpassword') login(request, user) render(request, 'auth_lifecycle/user_profile.html', context_instance=requestcontext(request))

because view must return render, not phone call it. alter lastly line to

return render(request, 'auth_lifecycle/user_profile.html', context_instance=requestcontext(request))

python django django-views

No comments:

Post a Comment