Created
July 4, 2014 22:27
-
-
Save tomgruner/5ce8bb1f4c55d17b5b25 to your computer and use it in GitHub Desktop.
Migrate from django social auth to python social auth
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thak you very much.