功能没有返回任何东西 [英] Function not returning anything
本文介绍了功能没有返回任何东西的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我的视图
def login(request):
c = {}
c.update(csrf(request))
return render_to_response(request,
'login.html', c)
def auth_view(request):
username = request.POST.get
('username', '')
password = request.POST.get
('password', '')
user = auth.authenticate
(username = username, password =
password)
if user is not None:
auth.login(request,user)
if request.method == 'POST':
return HttpResponseRedirect('accounts/loggedin/')
else:
Retun HttpResponseRedirect('accounts/invalid/')
错误发生在 auth_view
不返回任何东西。
Error occurs that function auth_view
is returning nothing.
推荐答案
如果用户
是无
, auth_view
不返回任何内容。你必须返回一个HttpResponse ...
If the user
is None
, auth_view
doesn't return anything. You must return an HttpResponse...
这篇关于功能没有返回任何东西的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文