django-social-auth“UserSocialAuth.user”必须是“实习生”实例

时间:2012-12-20 00:20:21

标签: django facebook login linkedin django-socialauth

我正在将django-social-auth集成到我现有的应用程序中。到目前为止,我已经做了所有事情,唯一缺少的是整合我的用户模型(实习生)女巫不使用auth.User模型到DSA。 当我尝试登录时,我收到以下消息:

"UserSocialAuth.user" must be a "Trainee" instance.

这是我的设置:

LINKEDIN_API_KEY = 'my_key'
LINKEDIN_SECRET_KEY = 'my_key'
LINKEDIN_CONSUMER_KEY = LINKEDIN_API_KEY
LINKEDIN_CONSUMER_SECRET = LINKEDIN_SECRET_KEY
LINKEDIN_SCOPE = ['r_basicprofile', 'r_emailaddress', 'r_fullprofile']
LINKEDIN_EXTRA_FIELD_SELECTORS = ['public-profile-url', 'picture-url', 'date-of-birth']


FACEBOOK_APP_ID = os.environ.get('FACEBOOK_APP_ID')
FACEBOOK_API_SECRET = os.environ.get('FACEBOOK_API_SECRET')
FACEBOOK_EXTENDED_PERMISSIONS = ['email']
# FACEBOOK_PROFILE_EXTRA_PARAMS = {'locale': 'en_US'}

AUTHENTICATION_BACKENDS = (
    # 'social_auth.backends.twitter.TwitterBackend',
    'social_auth.backends.facebook.FacebookBackend',
    # 'social_auth.backends.google.GoogleOAuthBackend',
    # 'social_auth.backends.google.GoogleOAuth2Backend',
    # 'social_auth.backends.google.GoogleBackend',
    # 'social_auth.backends.yahoo.YahooBackend',
    # 'social_auth.backends.browserid.BrowserIDBackend',
    'social_auth.backends.contrib.linkedin.LinkedinBackend',
    # 'social_auth.backends.contrib.disqus.DisqusBackend',
    # 'social_auth.backends.contrib.livejournal.LiveJournalBackend',
    # 'social_auth.backends.contrib.orkut.OrkutBackend',
    # 'social_auth.backends.contrib.foursquare.FoursquareBackend',
    # 'social_auth.backends.contrib.github.GithubBackend',
    # 'social_auth.backends.contrib.vkontakte.VKontakteBackend',
    # 'social_auth.backends.contrib.live.LiveBackend',
    # 'social_auth.backends.contrib.skyrock.SkyrockBackend',
    # 'social_auth.backends.contrib.yahoo.YahooOAuthBackend',
    # 'social_auth.backends.OpenIDBackend',
    'django.contrib.auth.backends.ModelBackend',
)

SOCIAL_AUTH_CREATE_USERS = False
SOCIAL_AUTH_LOGIN_REDIRECT_URL = '/'
SOCIAL_AUTH_USER_MODEL = 'trainee.Trainee'
SOCIAL_AUTH_PROTECTED_USER_FIELDS = ['email', 'username', 'name']

LOGIN_URL = '/home/'
LOGIN_REDIRECT_URL = '/'
LOGIN_ERROR_URL = '/'

SOCIAL_AUTH_PIPELINE = (
    'social_auth.backends.pipeline.social.social_auth_user',
    'social_auth.backends.pipeline.user.get_username',
    'social_auth.backends.pipeline.user.create_user',
    'social_auth.backends.pipeline.social.associate_user',
    'social_account.backends.login.extra_data',
    'social_auth.backends.pipeline.social.load_extra_data',
    'social_auth.backends.pipeline.user.update_user_details',
    # 'social_auth.backends.pipeline.associate.associate_by_email',
    'social_account.backends.login.process',
)

1 个答案:

答案 0 :(得分:0)

我删除了现有的django-social-auth表并再次运行了syncdb。