# 装饰器 def login_required(func): def inner(request): if not request.user.id: return redirect("/login/") else: ret=func(request) return ret return inner
@login_required def index(request): return render(request,"index.html")