我有一个 AJAX 请求,该请求POST
来自views.py
.
视图执行并打印“重定向”,但实际上并没有将用户重定向到当前视图之外。为什么?
def confirm_user(request):
response_json = {"status": "fail"}
if request.POST:
join_id = request.POST.get('join_id', "")
try:
u = UserProfile.objects.filter(join_id=join_id)[0].user
email = u.username
confirmed = u.userprofile.confirmed
response_json = {
"status": "success",
"confirmed": confirmed,
"email": email }
return HttpResponse(json.dumps(response_json),
mimetype="application/json")
except:
print "redirect"
return redirect('/')
else:
return redirect('/')