首页 > django.contrib.auth中的_auth_user_id属性是什么?

django.contrib.auth中的_auth_user_id属性是什么?

django的auth模块源码中有个SESSION_KEY = _auth_user_id


def _get_user_session_key(request):
# This value in the session is always serialized to a string, so we need
# to convert it back to Python whenever we access it.
return get_user_model()._meta.pk.to_python(request.session[SESSION_KEY])

django 的session应该用_auth_user_id为key

【热门文章】
【热门文章】