判断用户是否登录:
def deltableindex(req):
print '-------------------------'
print req.user.is_authenticated()
print '-------------------------'
if req.user.is_authenticated():
return render_to_response('deltableindex.html')
else:
return render(req, 'index.html')
System check identified no issues (0 silenced).
July 11, 2018 - 21:17:08
Django version 1.11, using settings 'mysite.settings'
Starting development server at http://0.0.0.0:9000/
Quit the server with CONTROL-C.
-------------------------
False
-------------------------
[11/Jul/2018 21:17:17] "GET /deltableindex/ HTTP/1.1" 200 1189
[11/Jul/2018 21:17:17] "GET /static/news/Css/Index/index.css HTTP/1.1" 304 0
[11/Jul/2018 21:17:17] "GET /static/news/scan.jpg HTTP/1.1" 304 0
[11/Jul/2018 21:17:17] "GET /static/news/login.jpg HTTP/1.1" 304 0