本文整理汇总了Python中social.apps.django_app.default.models.UserSocialAuth.extra_data方法的典型用法代码示例。如果您正苦于以下问题:Python UserSocialAuth.extra_data方法的具体用法?Python UserSocialAuth.extra_data怎么用?Python UserSocialAuth.extra_data使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类social.apps.django_app.default.models.UserSocialAuth
的用法示例。
在下文中一共展示了UserSocialAuth.extra_data方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _googleAuth
# 需要导入模块: from social.apps.django_app.default.models import UserSocialAuth [as 别名]
# 或者: from social.apps.django_app.default.models.UserSocialAuth import extra_data [as 别名]
def _googleAuth(user):
google_auth = UserSocialAuth()
google_auth.user = user
google_auth.provider = "google"
google_auth.uid = user.email
google_auth.extra_data = "{}"
return google_auth
示例2: create_users
# 需要导入模块: from social.apps.django_app.default.models import UserSocialAuth [as 别名]
# 或者: from social.apps.django_app.default.models.UserSocialAuth import extra_data [as 别名]
def create_users():
User.objects.exclude(pk=1).delete()
for pk, fields in users.iteritems():
if pk != 1:
if fields['email'] != '':
existing = User.objects.filter(email = fields['email'])
if existing.count() > 0:
ou = existing[0]
if ou.is_active == False and fields['is_active'] == True:
replace_users[ou.pk] = pk
for k,v in replace_users.iteritems():
if v == ou.pk:
replace_users[k] = pk
ou.delete()
elif ou.is_active == True and fields['is_active'] == False:
replace_users[pk] = ou.pk
for k,v in replace_users.iteritems():
if v == pk:
replace_users[k] = ou.pk
continue
else:
replace_users[ou.pk] = pk
for k,v in replace_users.iteritems():
if v == ou.pk:
replace_users[k] = pk
ou.delete()
#print "email:", fields['email']
nu = User(pk=pk)
nu.username = fields['username']
if fields['email']:
nu.email = fields['email']
nu.status = 1
nu.password = fields['password']
nu.full_name = fields['profile']['full_name']
nu.message = fields['profile']['message']
nu.is_active = fields['is_active']
nu.is_staff = fields['is_staff']
nu.is_superuser = fields['is_superuser']
nu.comment_count = fields['profile']['comment_count']
nu.dateo_count = fields['profile']['item_count']
nu.vote_count = fields['profile']['vote_count']
nu.client_domain = datea
nu.save()
joined = date_parser(fields['date_joined'])
lastlog = date_parser(fields['last_login'])
User.objects.filter(pk=nu.pk).update(date_joined=joined, created=joined, last_login=lastlog)
for pk, fields in usersSocial.iteritems():
if fields['user'] != 1:
nusoc = UserSocialAuth(pk=pk)
nusoc.provider = fields['provider']
nusoc.uid = fields['uid']
nusoc.user_id = get_user(int(fields['user']))
nusoc.extra_data = fields['extra_data']
nusoc.save()
示例3: setUp
# 需要导入模块: from social.apps.django_app.default.models import UserSocialAuth [as 别名]
# 或者: from social.apps.django_app.default.models.UserSocialAuth import extra_data [as 别名]
def setUp(self):
user = User.objects.create_user(username='596560',
email='[email protected]',
password='koichi-ezato')
user_social_auth = UserSocialAuth()
user_social_auth.provider = 'evernote-sandbox'
user_social_auth.uid = '596560'
user_social_auth.extra_data = '{"access_token": {"edam_webApiUrlPrefix": "https://sandbox.evernote.com/shard/s1/", "edam_shard": "s1", "oauth_token": "S=s1:U=91a50:E=158f7ee9efa:C=151a03d7140:P=185:A=koichi-ezato-3816:V=2:H=1a4e5efcc8f63951e17852d0c8019cab", "edam_expires": "1481628360442", "edam_userId": "596560", "edam_noteStoreUrl": "https://sandbox.evernote.com/shard/s1/notestore"}, "expires": 1481628360, "store_url": "https://sandbox.evernote.com/shard/s1/notestore", "oauth_token": "S=s1:U=91a50:E=158f7ee9efa:C=151a03d7140:P=185:A=koichi-ezato-3816:V=2:H=1a4e5efcc8f63951e17852d0c8019cab"}'
user_social_auth.user = user
user_social_auth.save()