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


Python MSocialProfile.profile方法代码示例

本文整理汇总了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,
    }
开发者ID:1761461582,项目名称:NewsBlur,代码行数:10,代码来源:utils_tags.py

示例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,
    }
开发者ID:1761461582,项目名称:NewsBlur,代码行数:11,代码来源:utils_tags.py

示例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)
开发者ID:linuxayn,项目名称:NewsBlur,代码行数:19,代码来源:views.py

示例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)
开发者ID:0077cc,项目名称:NewsBlur,代码行数:39,代码来源:views.py

示例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}
开发者ID:Chorior,项目名称:NewsBlur,代码行数:7,代码来源:utils_tags.py

示例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}
开发者ID:Chorior,项目名称:NewsBlur,代码行数:7,代码来源:utils_tags.py


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