当前位置: 首页>>代码示例>>Python>>正文


Python UserProfile.website方法代码示例

本文整理汇总了Python中accounts.models.UserProfile.website方法的典型用法代码示例。如果您正苦于以下问题:Python UserProfile.website方法的具体用法?Python UserProfile.website怎么用?Python UserProfile.website使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在accounts.models.UserProfile的用法示例。


在下文中一共展示了UserProfile.website方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: save

# 需要导入模块: from accounts.models import UserProfile [as 别名]
# 或者: from accounts.models.UserProfile import website [as 别名]
 def save(self,request):
     if self.cleaned_data['city'] or self.cleaned_data['website'] or self.cleaned_data['intro'] or self.cleaned_data['qq'] or self.cleaned_data['msn'] or self.cleaned_data['avatar']:
        
         current_user = request.user
        
         try:
             profile = current_user.get_profile()
         except UserProfile.DoesNotExist:
             profile = None
         
         if not profile:
             profile = UserProfile()
             profile.user = current_user
             profile.song_ord_filed = 'post_datetime'
             
         profile.city = self.cleaned_data['city']
         profile.website = self.cleaned_data['website']
         profile.intro = self.cleaned_data['intro']
         profile.qq = self.cleaned_data['qq']
         profile.msn = self.cleaned_data['msn']
         if 'avatar' in request.FILES:
             
             #删除掉原头像
             import os
             if profile and profile.avatar and os.path.exists(profile.avatar.path):
                 os.remove(profile.avatar.path)
                              
             profile.avatar = self.cleaned_data['avatar']#request.FILES["avatar"]
         profile.save()
         
         if self.cleaned_data['username'] != current_user.username:
             current_user.username = self.cleaned_data['username']
             current_user.save()
开发者ID:andy071001,项目名称:dongtingfm,代码行数:35,代码来源:forms.py

示例2: create_userprofile

# 需要导入模块: from accounts.models import UserProfile [as 别名]
# 或者: from accounts.models.UserProfile import website [as 别名]
def create_userprofile(user):
  p = UserProfile()
  p.user = user
  p.birth = datetime.datetime.now()
  p.mobile = '+417X1234567'
  p.private_phone = '+41221234567'
  p.instrument = random.choice([k[0] for k in UserProfile.instrument_choices])
  p.language = random.choice([k[0] for k in settings.LANGUAGES])
  p.im = user.email
  p.im_carrier = random.choice([k[0] for k in UserProfile.im_choices])
  p.website = 'www.example.com'
  p.saying = 'Nothing to say'
  p.address = 'Do not known St, xyz, No Country'
  p.save()
开发者ID:anjos,项目名称:unidos-website,代码行数:16,代码来源:tests_initial.py

示例3: welcome_douban

# 需要导入模块: from accounts.models import UserProfile [as 别名]
# 或者: from accounts.models.UserProfile import website [as 别名]
def welcome_douban(request):
    api_operation = ApiOperation(key='default')
    results = None
    error_message = ''
    key = request.GET.get('oauth_token', '')
    if key:
        request_token = getRequestToken(key)
        if request_token:
            results = api_operation.getServiceFromRequest(request_token)
    if results:
        service, uid = results
        profile = UserData(uid).getProfile()
        if profile:
            try:
                new_user = User.objects.create_user(username = profile['uid'],
                                                    password = profile['uid'])
                new_user.backend="%s.%s" %('django.contrib.auth.backends','ModelBackend')
                #以新用户登陆
                auth.login(request, new_user)
                info = UserProfile(user=new_user)
                info.nickname = profile['nickname']
                info.image_link = profile['image_link']
                info.sign = profile['signature']
                info.website = profile['website']
                info.introduction = profile['introduction']
                info.did = profile['uid']
                try:
                    info.save()
                except Exception, error:
                    logger.debug(str(error))
                
                #启动新用户的后台线程 完成推荐数据的初始化
                InitData.initUserData(uid)
                
                #设置密码, 默认为用户名
                user_form = UserChangeForm(instance=new_user)
                return render_to_response("accounts/settings.html", {
                        'msg':"请设置登录密码, 现在默认和用户名相同",
                        'user_form':user_form
                        },context_instance=RequestContext(request))
            except Exception, error:
                error_message = _("Sorry, we have a error when create new user: %s."%(error))
开发者ID:klb3713,项目名称:BYSJ,代码行数:44,代码来源:views.py


注:本文中的accounts.models.UserProfile.website方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。