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


Python GsuserManager.list_recommend_by_userid方法代码示例

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


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

示例1: get_common_user_dict

# 需要导入模块: from gitshell.gsuser.models import GsuserManager [as 别名]
# 或者: from gitshell.gsuser.models.GsuserManager import list_recommend_by_userid [as 别名]
def get_common_user_dict(request, gsuser, gsuserprofile):
    feedAction = FeedAction()
    raw_watch_users = feedAction.get_watch_users(gsuser.id, 0, 10)
    raw_bewatch_users = feedAction.get_bewatch_users(gsuser.id, 0, 10)
    watch_user_ids = [int(x[0]) for x in raw_watch_users]
    bewatch_user_ids = [int(x[0]) for x in raw_bewatch_users]
    watch_users_map = GsuserManager.map_users(watch_user_ids)
    bewatch_users_map = GsuserManager.map_users(bewatch_user_ids)
    watch_users = [watch_users_map[x] for x in watch_user_ids if x in watch_users_map]
    bewatch_users = [bewatch_users_map[x] for x in bewatch_user_ids if x in bewatch_users_map]
    raw_recommends = GsuserManager.list_recommend_by_userid(gsuser.id, 0, 20)
    recommends = __conver_to_recommends_vo(raw_recommends)

    is_watched_user = False
    if request.user.is_authenticated():
        is_watched_user = RepoManager.is_watched_user(request.user.id, gsuser.id)
    return {'gsuser': gsuser, 'gsuserprofile': gsuserprofile, 'watch_users': watch_users, 'bewatch_users': bewatch_users, 'recommends': recommends, 'is_watched_user': is_watched_user, 'show_common': True}
开发者ID:ZheYuan,项目名称:gitshell,代码行数:19,代码来源:views.py

示例2: recommend

# 需要导入模块: from gitshell.gsuser.models import GsuserManager [as 别名]
# 或者: from gitshell.gsuser.models.GsuserManager import list_recommend_by_userid [as 别名]
def recommend(request, user_name):
    gsuser = GsuserManager.get_user_by_name(user_name)
    if gsuser is None:
        raise Http404
    if request.method == 'POST':
        recommendsForm = RecommendsForm(request.POST)
        if recommendsForm.is_valid() and request.user.is_authenticated():
            content = recommendsForm.cleaned_data['content'].strip()
            if content != '':
                recommend = Recommend()
                recommend.user_id = gsuser.id
                recommend.content = content
                recommend.from_user_id = request.user.id
                recommend.save()
    gsuserprofile = GsuserManager.get_userprofile_by_id(gsuser.id)
    raw_recommends = GsuserManager.list_recommend_by_userid(gsuser.id, 0, 50)
    recommends = __conver_to_recommends_vo(raw_recommends)

    response_dictionary = {'mainnav': 'user', 'recommends': recommends}
    response_dictionary.update(get_common_user_dict(request, gsuser, gsuserprofile))
    return render_to_response('user/recommend.html',
                          response_dictionary,
                          context_instance=RequestContext(request))
开发者ID:ZheYuan,项目名称:gitshell,代码行数:25,代码来源:views.py


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