本文整理汇总了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()
示例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()
示例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))