Py学习  »  问与答

请教,通过Authentication 系统登录后,怎么在request里获的上次的登录的时间?

645556350 • 9 年前 • 2564 次点击  

在官方文档里只找到user的几种方法,但没看到能 get_last_login 的方法: https://docs.djangoproject.com/en/1.8/ref/contrib/auth/#django.contrib.auth.models.AnonymousUser

class models.User

get_username()

is_anonymous()

is_authenticated()

get_full_name()

get_short_name()

请问是要自己去数据库里寻找。。。还是有其他我不知道的方法。

Python社区是高质量的Python/Django开发社区
本文地址:http://www.python88.com/topic/1067
 
2564 次点击  
文章 [ 2 ]  |  最新文章 8 年前
younger.x.shen
Reply   •   1 楼
younger.x.shen    8 年前

存在数据库中了,你也可以存在cookie里

cdxfish
Reply   •   2 楼
cdxfish    8 年前

user.last_login 上次登录 user.date_joined 创建时间