'Return the user_id stored in the session of the request.'

@staticmethod
def get_user_id_from_session(request):

    from django.contrib.auth import _get_user_session_key
    try:
        return _get_user_session_key(request)
    except KeyError:
        return None
