コード例 #1
0
def create_user(strategy, details, response, uid, user=None, *args, **kwargs):
    info = social_create_user(strategy, details, response, uid, user, *args,
                              **kwargs)

    if info['is_new']:
        user = info['user']
        if settings.PYHN_NEW_USER_CAN_SUBMIT:
            permission = Permission.objects.get(codename='can_submit')
            user.user_permissions.add(permission)

        profile = Profile(user_ptr=user)
        profile.username = user.username
        profile.email = user.email
        profile.about = ''
        profile.save()

    return {'is_new': True, 'user': user}
コード例 #2
0
ファイル: pipeline.py プロジェクト: akun/PyHackerNews
def create_user(strategy, details, response, uid, user=None, *args, **kwargs):
    info = social_create_user(
        strategy, details, response, uid, user, *args, **kwargs
    )

    if info['is_new']:
        user = info['user']
        if settings.PYHN_NEW_USER_CAN_SUBMIT:
            permission = Permission.objects.get(codename='can_submit')
            user.user_permissions.add(permission)

        profile = Profile(user_ptr=user)
        profile.username = user.username
        profile.email = user.email
        profile.about = ''
        profile.save()

    return {'is_new': True, 'user': user}
コード例 #3
0
ファイル: forms.py プロジェクト: akun/PyHackerNews
 def save(self, user):
     profile = Profile(user_ptr=user)
     profile.username = self.cleaned_data['username']
     profile.email = self.cleaned_data['email']
     profile.about = self.cleaned_data['about']
     profile.save()
コード例 #4
0
ファイル: forms.py プロジェクト: q1f3/PyHackerNews
 def save(self, user):
     profile = Profile(user_ptr=user)
     profile.username = self.cleaned_data['username']
     profile.email = self.cleaned_data['email']
     profile.about = self.cleaned_data['about']
     profile.save()