Slide 25
Slide 25 text
Daniel Greenfeld
@pydanny
Part IV: profile/views.py
from social_auth.signals import pre_update
from social_auth.backends.contrib.github import GithubBackend
from profiles.models. import Profile
def github_user_update(sender, user, response, details, **kwargs):
profile_instance, created = Profile.objects.get_or_create(user=user)
profile_instance.save()
return True
pre_update.connect(github_user_update, sender=GithubBackend)
(Not specifying this view in urls - django-social-auth does it for me)
Thursday, October 27, 11