【发布时间】:2019-12-23 07:29:41
【问题描述】:
我是新的 Django,我正在创建一个简单的登录页面,并希望在用户单击登录表单中的登录按钮后立即使用用户信息重定向到主页,用户应使用用户名重定向到主页
def login1(req):
if req.method == 'POST':
user = ppl.objects.filter(username = req.POST['text'])
print(req.POST['text'])
pwd = ppl.objects.filter(pwd = req.POST['pass'])
print(req.POST['pass'])
if user and pwd:
return HttpResponseRedirect(reverse('home', {'u':user}))
else:
return render(req,'login.html',{'error':"username and password does not match"})
【问题讨论】:
标签: django authentication