本文整理汇总了Python中socialregistration.signals.connect.connect函数的典型用法代码示例。如果您正苦于以下问题:Python connect函数的具体用法?Python connect怎么用?Python connect使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了connect函数的16个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: test_connecting_should_send_the_connect_signal
def test_connecting_should_send_the_connect_signal(self):
counter = self.get_counter()
user = self.create_user()
self.login()
def handler(sender, **kwargs):
counter.counter += 1
self.assertEqual(self.profile, sender)
connect.connect(handler, sender=self.profile, dispatch_uid='socialreg.test.connect')
self.flow()
self.assertEqual(1, counter.counter)
开发者ID:CheckiO,项目名称:django-socialregistration,代码行数:15,代码来源:tests.py
示例2: GoogleProfile
class GoogleProfile(models.Model):
user = models.ForeignKey(User, unique=True)
site = models.ForeignKey(Site, default=Site.objects.get_current)
google_id = models.CharField(max_length = 255)
def __unicode__(self):
try:
return u'%s: %s' % (self.user, self.google_id)
except User.DoesNotExist:
return u'None'
def authenticate(self):
return authenticate(id=self.google_id)
class GoogleAccessToken(models.Model):
profile = models.OneToOneField(GoogleProfile, related_name='access_token')
access_token = models.CharField(max_length=255)
def save_google_token(sender, user, profile, client, **kwargs):
try:
GoogleAccessToken.objects.get(profile=profile).delete()
except GoogleAccessToken.DoesNotExist:
pass
GoogleAccessToken.objects.create(access_token = client.get_access_token(),
profile = profile)
connect.connect(save_google_token, sender=GoogleProfile,
dispatch_uid='socialregistration_google_token')
开发者ID:kippt,项目名称:django-socialregistration,代码行数:30,代码来源:models.py
示例3: __unicode__
vk_uid = models.CharField(max_length=255, blank=False, null=False)
def __unicode__(self):
try:
return u'%s: %s' % (self.user, self.vk_uid)
except models.DoesNotExist:
return u'None'
def authenticate(self):
return authenticate(vk_uid=self.vk_uid)
class VkontakteAccessToken(models.Model):
profile = models.OneToOneField(VkontakteProfile, related_name='access_token')
access_token = models.CharField(max_length=255)
def save_vkontakte_token(sender, user, profile, client, **kwargs):
try:
VkontakteAccessToken.objects.get(profile=profile).delete()
except VkontakteAccessToken.DoesNotExist:
pass
VkontakteAccessToken.objects.create(profile=profile,
access_token=client._access_token)
connect.connect(save_vkontakte_token, sender=VkontakteProfile,
dispatch_uid='socialregistration.vkontakte.connect')
login.connect(save_vkontakte_token, sender=VkontakteProfile,
dispatch_uid='socialregistration.vkontakte.login')
开发者ID:hoongun,项目名称:django-socialregistration,代码行数:30,代码来源:models.py
示例4: BufferProfile
class BufferProfile(models.Model):
user = models.ForeignKey(User, unique=True)
site = models.ForeignKey(Site, default=Site.objects.get_current)
buffer_user = models.CharField(max_length = 255)
def __unicode__(self):
try:
return u'%s: %s' % (self.user, self.buffer_user)
except User.DoesNotExist:
return u'None'
def authenticate(self):
return authenticate(buffer_user=self.buffer_user)
class BufferAccessToken(models.Model):
profile = models.OneToOneField(BufferProfile, related_name='access_token')
access_token = models.CharField(max_length=255)
def save_buffer_token(sender, user, profile, client, **kwargs):
try:
BufferAccessToken.objects.get(profile=profile).delete()
except BufferAccessToken.DoesNotExist:
pass
BufferAccessToken.objects.create(access_token = client.get_access_token(),
profile = profile)
connect.connect(save_buffer_token, sender=BufferProfile,
dispatch_uid='socialregistration_buffer_token')
开发者ID:kippt,项目名称:django-socialregistration,代码行数:30,代码来源:models.py
示例5: __unicode__
site = models.ForeignKey(Site, default=Site.objects.get_current)
uid = models.CharField(max_length=255, blank=False, null=False)
def __unicode__(self):
try:
return u'%s: %s' % (self.user, self.uid)
except models.ObjectDoesNotExist:
return u'None'
def authenticate(self):
return authenticate(uid=self.uid)
class FacebookAccessToken(models.Model):
profile = models.OneToOneField(FacebookProfile, related_name='access_token')
access_token = models.CharField(max_length=255)
def save_facebook_token(sender, user, profile, client, **kwargs):
try:
FacebookAccessToken.objects.get(profile=profile).delete()
except FacebookAccessToken.DoesNotExist:
pass
FacebookAccessToken.objects.create(profile=profile,
access_token=client.graph.access_token)
connect.connect(save_facebook_token, sender=FacebookProfile,
dispatch_uid='socialregistration.facebook.connect')
login.connect(save_facebook_token, sender = FacebookProfile,
dispatch_uid = 'socialregistration.facebook.login')
开发者ID:CheckiO,项目名称:django-socialregistration,代码行数:30,代码来源:models.py
示例6: GithubProfile
class GithubProfile(models.Model):
user = models.ForeignKey(AUTH_USER_MODEL, unique=True)
site = models.ForeignKey(Site, default=Site.objects.get_current)
github = models.CharField(max_length = 255)
def __unicode__(self):
try:
return u'%s: %s' % (self.user, self.github)
except models.ObjectDoesNotExist:
return u'None'
def authenticate(self):
return authenticate(github=self.github)
class GithubAccessToken(models.Model):
profile = models.OneToOneField(GithubProfile, related_name='access_token')
access_token = models.CharField(max_length=255)
def save_github_token(sender, user, profile, client, **kwargs):
try:
GithubAccessToken.objects.get(profile=profile).delete()
except GithubAccessToken.DoesNotExist:
pass
GithubAccessToken.objects.create(access_token = client.get_access_token(),
profile = profile)
connect.connect(save_github_token, sender=GithubProfile,
dispatch_uid='socialregistration_github_token')
开发者ID:CheckiO,项目名称:django-socialregistration,代码行数:30,代码来源:models.py
示例7: TwitterRequestToken
class TwitterRequestToken(models.Model):
profile = models.OneToOneField(TwitterProfile, related_name='request_token')
oauth_token = models.CharField(max_length=80)
oauth_token_secret = models.CharField(max_length=80)
class TwitterAccessToken(models.Model):
profile = models.OneToOneField(TwitterProfile, related_name='access_token')
oauth_token = models.CharField(max_length=80)
oauth_token_secret = models.CharField(max_length=80)
def save_twitter_token(sender, user, profile, client, **kwargs):
try:
TwitterRequestToken.objects.get(profile=profile).delete()
except TwitterRequestToken.DoesNotExist:
pass
try:
TwitterAccessToken.objects.get(profile=profile).delete()
except TwitterAccessToken.DoesNotExist:
pass
TwitterRequestToken.objects.create(profile=profile,
oauth_token=client.get_request_token().key,
oauth_token_secret=client.get_request_token().secret)
TwitterAccessToken.objects.create(profile=profile,
oauth_token=client.get_access_token().key,
oauth_token_secret=client.get_access_token().secret)
connect.connect(save_twitter_token, sender=TwitterProfile,
dispatch_uid='socialregistration_twitter_token')
开发者ID:InsiderNine,项目名称:django-socialregistration,代码行数:30,代码来源:models.py
示例8: TumblrRequestToken
class TumblrRequestToken(models.Model):
profile = models.OneToOneField(TumblrProfile, related_name='request_token')
oauth_token = models.CharField(max_length=80)
oauth_token_secret = models.CharField(max_length=80)
class TumblrAccessToken(models.Model):
profile = models.OneToOneField(TumblrProfile, related_name='access_token')
oauth_token = models.CharField(max_length=80)
oauth_token_secret = models.CharField(max_length=80)
def save_tumblr_token(sender, user, profile, client, **kwargs):
try:
TumblrRequestToken.objects.get(profile=profile).delete()
except TumblrRequestToken.DoesNotExist:
pass
try:
TumblrAccessToken.objects.get(profile=profile).delete()
except TumblrAccessToken.DoesNotExist:
pass
TumblrRequestToken.objects.create(profile=profile,
oauth_token=client.get_request_token().key,
oauth_token_secret=client.get_request_token().secret)
TumblrAccessToken.objects.create(profile=profile,
oauth_token=client.get_access_token().key,
oauth_token_secret=client.get_access_token().secret)
connect.connect(save_tumblr_token, sender=TumblrProfile,
dispatch_uid='socialregistration_tumblr_token')
开发者ID:brodie,项目名称:django-socialregistration,代码行数:30,代码来源:models.py
示例9: FoursquareProfile
class FoursquareProfile(models.Model):
user = models.OneToOneField(AUTH_USER_MODEL)
site = models.ForeignKey(Site, default=get_default_site)
foursquare = models.CharField(max_length=255)
def __unicode__(self):
try:
return u'%s: %s' % (self.user, self.foursquare)
except models.ObjectDoesNotExist:
return u'None'
def authenticate(self):
return authenticate(foursquare=self.foursquare)
class FoursquareAccessToken(models.Model):
profile = models.OneToOneField(FoursquareProfile, related_name='access_token')
access_token = models.CharField(max_length=255)
def save_foursquare_token(sender, user, profile, client, **kwargs):
try:
FoursquareAccessToken.objects.get(profile=profile).delete()
except FoursquareAccessToken.DoesNotExist:
pass
FoursquareAccessToken.objects.create(access_token=client.get_access_token(),
profile=profile)
connect.connect(save_foursquare_token, sender=FoursquareProfile,
dispatch_uid='socialregistration_foursquare_token')
开发者ID:brodie,项目名称:django-socialregistration,代码行数:30,代码来源:models.py
示例10: UntappdProfile
class UntappdProfile(models.Model):
user = models.ForeignKey(User, unique=True)
site = models.ForeignKey(Site, default=Site.objects.get_current)
untappd = models.CharField(max_length=255)
def __unicode__(self):
try:
return u'%s: %s' % (self.user, self.untappd)
except User.DoesNotExist:
return u'None'
def authenticate(self):
return authenticate(untappd=self.untappd)
class UntappdAccessToken(models.Model):
profile = models.OneToOneField(UntappdProfile, related_name='access_token')
access_token = models.CharField(max_length=255)
def save_untappd_token(sender, user, profile, client, **kwargs):
try:
UntappdAccessToken.objects.get(profile=profile).delete()
except UntappdAccessToken.DoesNotExist:
pass
UntappdAccessToken.objects.create(access_token=client.get_access_token(),
profile=profile)
connect.connect(save_untappd_token, sender=UntappdProfile,
dispatch_uid='pykeg_connect_untappd_token')
开发者ID:MarcusFulbright,项目名称:kegbot,代码行数:29,代码来源:models.py
示例11: LinkedInAccessToken
oauth_token = models.CharField(max_length=80)
oauth_token_secret = models.CharField(max_length=80)
class LinkedInAccessToken(models.Model):
profile = models.OneToOneField(LinkedInProfile, related_name='access_token')
oauth_token = models.CharField(max_length=80)
oauth_token_secret = models.CharField(max_length=80)
def save_linkedin_token(sender, user, profile, client, **kwargs):
try:
LinkedInRequestToken.objects.get(profile=profile).delete()
except LinkedInRequestToken.DoesNotExist:
pass
try:
LinkedInAccessToken.objects.get(profile=profile).delete()
except LinkedInAccessToken.DoesNotExist:
pass
LinkedInRequestToken.objects.create(profile=profile,
oauth_token=client.get_request_token().key,
oauth_token_secret=client.get_request_token().secret)
LinkedInAccessToken.objects.create(profile=profile,
oauth_token=client.get_access_token().key,
oauth_token_secret=client.get_access_token().secret)
connect.connect(save_linkedin_token, sender=LinkedInProfile,
dispatch_uid='socialregistration_linkedin_token')
开发者ID:GeoRemindMe,项目名称:GeoRemindMe_Platform,代码行数:30,代码来源:models.py
示例12: save_linkedin_token
oauth_token_secret = client.request_token['oauth_token_secret'])
TwitterAccessToken.objects.create(profile=profile,
oauth_token = client.access_token['oauth_token'],
oauth_token_secret = client.access_token['oauth_token_secret'])
def save_linkedin_token(sender, user, profile, client, **kwargs):
try:
LinkedInRequestToken.objects.get(profile=profile).delete()
except LinkedInRequestToken.DoesNotExist:
pass
try:
LinkedInAccessToken.objects.get(profile=profile).delete()
except LinkedInAccessToken.DoesNotExist:
pass
LinkedInRequestToken.objects.create(profile=profile,
oauth_token = client.request_token['oauth_token'],
oauth_token_secret = client.request_token['oauth_token_secret'])
LinkedInAccessToken.objects.create(profile=profile,
oauth_token = client.access_token['oauth_token'],
oauth_token_secret = client.access_token['oauth_token_secret'])
connect.connect(save_facebook_token, sender = FacebookProfile,
dispatch_uid = 'socialregistration_facebook_token')
connect.connect(save_twitter_token, sender = TwitterProfile,
dispatch_uid = 'socialregistration_twitter_token')
connect.connect(save_linkedin_token, sender = LinkedInProfile,
dispatch_uid = 'socialregistration_linkedin_token')
开发者ID:jablko,项目名称:django-socialregistration,代码行数:30,代码来源:models.py
示例13: InstagramProfile
class InstagramProfile(models.Model):
user = models.ForeignKey(AUTH_USER_MODEL, unique=True)
site = models.ForeignKey(Site, default=get_default_site)
instagram = models.CharField(max_length = 255)
def __unicode__(self):
try:
return u'%s: %s' % (self.user, self.instagram)
except models.ObjectDoesNotExist:
return u'None'
def authenticate(self):
return authenticate(instagram=self.instagram)
class InstagramAccessToken(models.Model):
profile = models.OneToOneField(InstagramProfile, related_name='access_token')
access_token = models.CharField(max_length=255)
def save_instagram_token(sender, user, profile, client, **kwargs):
try:
InstagramAccessToken.objects.get(profile=profile).delete()
except InstagramAccessToken.DoesNotExist:
pass
InstagramAccessToken.objects.create(access_token = client.get_access_token(),
profile = profile)
connect.connect(save_instagram_token, sender=InstagramProfile,
dispatch_uid='socialregistration_instagram_token')
开发者ID:systemsoverload,项目名称:django-socialregistration,代码行数:30,代码来源:models.py
示例14: AppdotnetProfile
class AppdotnetProfile(models.Model):
user = models.ForeignKey(User, unique=True)
site = models.ForeignKey(Site, default=Site.objects.get_current)
appdotnet_user = models.CharField(max_length = 255)
def __unicode__(self):
try:
return u'%s: %s' % (self.user, self.appdotnet_user)
except User.DoesNotExist:
return u'None'
def authenticate(self):
return authenticate(buffer_user=self.buffer_user)
class AppdotnetAccessToken(models.Model):
profile = models.OneToOneField(AppdotnetProfile, related_name='access_token')
access_token = models.CharField(max_length=255)
def save_appdotnet_token(sender, user, profile, client, **kwargs):
try:
AppdotnetAccessToken.objects.get(profile=profile).delete()
except AppdotnetAccessToken.DoesNotExist:
pass
AppdotnetAccessToken.objects.create(access_token = client.get_access_token(),
profile = profile)
connect.connect(save_appdotnet_token, sender=AppdotnetProfile,
dispatch_uid='socialregistration_appdotnet_token')
开发者ID:kippt,项目名称:django-socialregistration,代码行数:30,代码来源:models.py
示例15: SapoRequestToken
class SapoRequestToken(models.Model):
profile = models.OneToOneField(SapoProfile, related_name='request_token')
oauth_token = models.CharField(max_length=512)
oauth_token_secret = models.CharField(max_length=80)
class SapoAccessToken(models.Model):
profile = models.OneToOneField(SapoProfile, related_name='access_token')
oauth_token = models.CharField(max_length=512)
oauth_token_secret = models.CharField(max_length=80)
def save_sapo_token(sender, user, profile, client, **kwargs):
try:
SapoRequestToken.objects.get(profile=profile).delete()
except SapoRequestToken.DoesNotExist:
pass
try:
SapoAccessToken.objects.get(profile=profile).delete()
except SapoAccessToken.DoesNotExist:
pass
SapoRequestToken.objects.create(profile=profile,
oauth_token=client.get_request_token().key,
oauth_token_secret=client.get_request_token().secret)
SapoAccessToken.objects.create(profile=profile,
oauth_token=client.get_access_token().key,
oauth_token_secret=client.get_access_token().secret)
connect.connect(save_sapo_token, sender=SapoProfile,
dispatch_uid='socialregistration_sapo_token')
开发者ID:cpinto,项目名称:django-socialregistration,代码行数:30,代码来源:models.py
示例16: assign
userenaSignup = UserenaSignup.objects.get_or_create(user=user)
# Create profile for user
try:
new_profile = Profile.objects.get(user=user)
except:
new_profile = Profile.objects.create(user=user)
# Set some minimal permissions
for perm in PERMISSIONS['profile']:
assign(perm, new_profile.user, new_profile)
for perm in PERMISSIONS['user']:
assign(perm, new_profile.user, new_profile.user)
profile_connect.connect(social_connect_callback)
""""""""""""""""""""""""""""""""""""""""""
from socialregistration.signals import connect as profile_connect
from userena.managers import ASSIGNED_PERMISSIONS
@receiver(socialregistration_signals.connect, sender = FacebookProfile, dispatch_uid = 'facebook.connect')
def social_connect_callback(sender, user, profile, client, **kwargs):
"""
Create a profile for this user after connecting
开发者ID:andreyshipilov,项目名称:wknd_django,代码行数:31,代码来源:_social_registration_userena.py
注:本文中的socialregistration.signals.connect.connect函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论