Newer
Older
from __future__ import print_function
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "relate.settings")
import django
django.setup()
from django.contrib.sessions.models import Session
from accounts.models import User
import sys
session_key = sys.argv[1]
session = Session.objects.get(session_key=session_key)
uid = session.get_decoded().get('_auth_user_id')
user = User.objects.get(pk=uid)
print(user.username, user.get_full_name(), user.email)