Py学习  »  Django

请教怎样判断实现页面的跳转

令狐空 • 11 年前 • 5879 次点击  

我的代码:

@login_required()
def Cb(request):
    if "请先登陆" in request.GET:
    return HttpResponseRedirect("http://www.123456.com")
    else:
    User=request.user.username
    return render_to_response('123.html',{'User':User,})`

这样写页面报错,求助大家了~

Python社区是高质量的Python/Django开发社区
本文地址:http://www.python88.com/topic/621
文章 [ 2 ]  |  最新文章 11 年前
v f
Reply   •   1 楼
v f    11 年前

别的不说,语句的写法不对。 if......: ...... else: ...... 缩进在python中是很重要的,一般是4个空格

Py站长
Reply   •   2 楼
Py站长    11 年前

报什么错》