Skip to content

Instantly share code, notes, and snippets.

@klashxx
Last active July 12, 2018 10:06
Show Gist options
  • Save klashxx/da42c6441b0e3cc5de3fe1d6002d5c1f to your computer and use it in GitHub Desktop.
Save klashxx/da42c6441b0e3cc5de3fe1d6002d5c1f to your computer and use it in GitHub Desktop.
from django.contrib.sessions.models import Session
from account.models import Usuario
for s in Session.objects.all():
print (s)
uid = s.get_decoded().get('_auth_user_id')
if uid is None:
continue
user = Usuario.objects.get(pk=uid)
print (user.username, user.get_full_name())
# Session.objects.all().delete()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment