本文整理汇总了Python中apps.social.models.MSocialProfile.profile方法的典型用法代码示例。如果您正苦于以下问题:Python MSocialProfile.profile方法的具体用法?Python MSocialProfile.profile怎么用?Python MSocialProfile.profile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类apps.social.models.MSocialProfile
的用法示例。
在下文中一共展示了MSocialProfile.profile方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: render_recommended_users
# 需要导入模块: from apps.social.models import MSocialProfile [as 别名]
# 或者: from apps.social.models.MSocialProfile import profile [as 别名]
def render_recommended_users(context):
user = get_user(context['user'])
profile = MSocialProfile.profile(user.pk)
return {
'user': user,
'profile': profile,
}
示例2: render_getting_started
# 需要导入模块: from apps.social.models import MSocialProfile [as 别名]
# 或者: from apps.social.models.MSocialProfile import profile [as 别名]
def render_getting_started(context):
user = get_user(context['user'])
profile = MSocialProfile.profile(user.pk)
return {
'user': user,
'user_profile': user.profile,
'social_profile': profile,
}
示例3: set_account_settings
# 需要导入模块: from apps.social.models import MSocialProfile [as 别名]
# 或者: from apps.social.models.MSocialProfile import profile [as 别名]
def set_account_settings(request):
code = -1
message = 'OK'
form = AccountSettingsForm(user=request.user, data=request.POST)
if form.is_valid():
form.save()
code = 1
else:
message = form.errors[form.errors.keys()[0]][0]
payload = {
"username": request.user.username,
"email": request.user.email,
"social_profile": MSocialProfile.profile(request.user.pk)
}
return dict(code=code, message=message, payload=payload)
示例4: set_account_settings
# 需要导入模块: from apps.social.models import MSocialProfile [as 别名]
# 或者: from apps.social.models.MSocialProfile import profile [as 别名]
def set_account_settings(request):
code = 1
message = ''
post_settings = request.POST
if post_settings['username'] and request.user.username != post_settings['username']:
try:
User.objects.get(username__iexact=post_settings['username'])
except User.DoesNotExist:
request.user.username = post_settings['username']
request.user.save()
social_profile = MSocialProfile.get_user(request.user.pk)
social_profile.username = post_settings['username']
social_profile.save()
else:
code = -1
message = "This username is already taken. Try something different."
if request.user.email != post_settings['email']:
if not post_settings['email'] or not User.objects.filter(email=post_settings['email']).count():
request.user.email = post_settings['email']
request.user.save()
else:
code = -2
message = "This email is already being used by another account. Try something different."
if code != -1 and (post_settings['old_password'] or post_settings['new_password']):
code = change_password(request.user, post_settings['old_password'], post_settings['new_password'])
if code == -3:
message = "Your old password is incorrect."
payload = {
"username": request.user.username,
"email": request.user.email,
"social_profile": MSocialProfile.profile(request.user.pk)
}
return dict(code=code, message=message, payload=payload)
示例5: render_getting_started
# 需要导入模块: from apps.social.models import MSocialProfile [as 别名]
# 或者: from apps.social.models.MSocialProfile import profile [as 别名]
def render_getting_started(context):
user = get_user(context["user"])
profile = MSocialProfile.profile(user.pk)
return {"user": user, "user_profile": user.profile, "social_profile": profile}
示例6: render_recommended_users
# 需要导入模块: from apps.social.models import MSocialProfile [as 别名]
# 或者: from apps.social.models.MSocialProfile import profile [as 别名]
def render_recommended_users(context):
user = get_user(context["user"])
profile = MSocialProfile.profile(user.pk)
return {"user": user, "profile": profile}