Skip to content

Instantly share code, notes, and snippets.

@tomgruner
Created July 4, 2014 22:27
Show Gist options
  • Save tomgruner/5ce8bb1f4c55d17b5b25 to your computer and use it in GitHub Desktop.
Save tomgruner/5ce8bb1f4c55d17b5b25 to your computer and use it in GitHub Desktop.
Migrate from django social auth to python social auth
from django.contrib.sessions.models import Session
for s in Session.objects.iterator():
session_dict = s.get_decoded()
if '_auth_user_backend' in session_dict.keys():
#New backend is social.backends.facebook.FacebookOAuth2
#Change from old backend
if session_dict['_auth_user_backend'] == 'social_auth.backends.facebook.FacebookBackend':
session_dict['_auth_user_backend'] = 'social.backends.facebook.FacebookOAuth2'
new_s = Session.objects.save(s.session_key, session_dict, s.expire_date)
print new_s.pk
@SalahAdDin
Copy link

Thak you very much.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment