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


Python Activity.get_player_activity方法代码示例

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


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

示例1: user_profile

# 需要导入模块: from wouso.interface.activity.models import Activity [as 别名]
# 或者: from wouso.interface.activity.models.Activity import get_player_activity [as 别名]
def user_profile(request, id, page=u'1'):
    try:
        profile = Player.objects.get(id=id)
    except Player.DoesNotExist:
        raise Http404

    # TODO: parca exista o functie in core pentru gravatar
    avatar = "http://www.gravatar.com/avatar/%s.jpg?d=monsterid"\
        % md5(profile.user.email).hexdigest()
    activity_list = Activity.get_player_activity(profile)

    top_user = profile.get_extension(TopUser)
    #top_user.topgroups = list(profile.groups.all())
    #for g in top_user.topgroups:
    #    g.week_evolution = top_user.week_evolution(relative_to=g)
    #    g.position = TopHistory.get_user_position(top_user, relative_to=g)
    history = History.user_points(profile)
    paginator = Paginator(activity_list, 10)

    try:
        activity = paginator.page(page)
    except (EmptyPage, InvalidPage):
        activity = paginator.page(paginator.num_pages)

    profile_actions = ''
    profile_superuser_actions = ''
    for g in get_games():
        profile_actions += g.get_profile_actions(request, profile)
        profile_superuser_actions += g.get_profile_superuser_actions(request, profile)

        # some hackish introspection
        if hasattr(g, 'user_model'):
            model = getattr(g, 'user_model')
            setattr(profile, model.__name__.lower(), profile.get_extension(model))
    #Fix to show succes message from report user form
    if 'report_msg' in request.session:
        message = request.session['report_msg']
        del request.session['report_msg']
    else:
        message=''

    return render_to_response('profile/profile.html',
                              {'profile': profile,
                               'avatar': avatar,
                               'activity': activity,
                               'top': top_user,
                               'scoring': history,
                               'profile_actions': profile_actions,
                               'profile_superuser_actions': profile_superuser_actions,
                               'message': message, },
                              context_instance=RequestContext(request))
开发者ID:TomyRO,项目名称:wouso,代码行数:53,代码来源:views.py

示例2: hub

# 需要导入模块: from wouso.interface.activity.models import Activity [as 别名]
# 或者: from wouso.interface.activity.models.Activity import get_player_activity [as 别名]
def hub(request):
    if request.user.is_anonymous():
        return anonymous_homepage(request)

    # check first time
    profile = request.user.get_profile()
    activity = Activity.get_player_activity(profile).count()
    if activity < 2:
        # first timer, show povestea
        from wouso.interface.apps.pages.models import StaticPage
        try:
            story = StaticPage.objects.get(slug='poveste')
        except: pass
        else:
            return HttpResponseRedirect(reverse('static_page', args=(story.slug,)))
    return homepage(request)
开发者ID:AndreiRO,项目名称:wouso,代码行数:18,代码来源:views.py

示例3: user_profile

# 需要导入模块: from wouso.interface.activity.models import Activity [as 别名]
# 或者: from wouso.interface.activity.models.Activity import get_player_activity [as 别名]
def user_profile(request, id, page=u'1'):
    if int(id) == request.user.get_profile().id:
        profile = request.user.get_profile()
    else:
        profile = get_object_or_404(Player, id=id)

    activity_list = Activity.get_player_activity(profile)

    top_user = profile.get_extension(TopUser)
    #top_user.topgroups = list(profile.groups.all())
    #for g in top_user.topgroups:
    #    g.week_evolution = top_user.week_evolution(relative_to=g)
    #    g.position = TopHistory.get_user_position(top_user, relative_to=g)
    history = History.user_points(profile)
    paginator = Paginator(activity_list, 10)

    try:
        activity = paginator.page(page)
    except (EmptyPage, InvalidPage):
        activity = paginator.page(paginator.num_pages)

    profile_actions = ''
    profile_superuser_actions = ''
    for g in get_games():
        profile_actions += g.get_profile_actions(request, profile)
        profile_superuser_actions += g.get_profile_superuser_actions(request, profile)

        # some hackish introspection
        if hasattr(g, 'user_model'):
            model = getattr(g, 'user_model')
            setattr(profile, model.__name__.lower(), profile.get_extension(model))
    #Fix to show succes message from report user form
    if 'report_msg' in request.session:
        message = request.session['report_msg']
        del request.session['report_msg']
    else:
        message=''

    return render_to_response('profile/profile.html',
                              {'profile': profile,
                               'activity': activity,
                               'top': top_user,
                               'scoring': history,
                               'profile_actions': profile_actions,
                               'profile_superuser_actions': profile_superuser_actions,
                               'message': message, },
                              context_instance=RequestContext(request))
开发者ID:cvicentiu,项目名称:wouso,代码行数:49,代码来源:views.py

示例4: user_profile

# 需要导入模块: from wouso.interface.activity.models import Activity [as 别名]
# 或者: from wouso.interface.activity.models.Activity import get_player_activity [as 别名]
def user_profile(request, id, page=u'1'):
    profile = get_object_or_404(Player, id=id)

    activity_list = Activity.get_player_activity(profile)

    top_user = profile.get_extension(TopUser)
    history = History.user_points(profile.user)
    paginator = Paginator(activity_list, 10)

    try:
        activity = paginator.page(page)
    except (EmptyPage, InvalidPage):
        activity = paginator.page(paginator.num_pages)

        # some hackish introspection
        if hasattr(g, 'user_model'):
            model = getattr(g, 'user_model')
            setattr(profile, model.__name__.lower(), profile.get_extension(model))
    #Fix to show succes message from report user form
    if 'report_msg' in request.session:
        message = request.session['report_msg']
        del request.session['report_msg']
    else:
        message=''

    challenge_launched_recently = Challenge.exist_last_day(date.today(),
                                        request.user.get_profile(), profile)
    specialquest_button = SpecialQuestGame.get_specialquest_user_button(request, profile)
    config_disable_magic = BoolSetting.get('setting-magic').get_value() is False

    return render_to_response('profile/profile.html',
                              {'profile': profile,
                               'activity': activity,
                               'top': top_user,
                               'scoring': history,
                               'challenge_launched_recently': challenge_launched_recently,
                               'specialquest_button': specialquest_button,
                               'config_disable_magic': config_disable_magic,
                               'message': message},
                              context_instance=RequestContext(request))
开发者ID:gabrielivascu,项目名称:wouso,代码行数:42,代码来源:views.py

示例5: ac

# 需要导入模块: from wouso.interface.activity.models import Activity [as 别名]
# 或者: from wouso.interface.activity.models.Activity import get_player_activity [as 别名]
 def ac(self):
     return Activity.get_player_activity(self).count()
开发者ID:TobyWanKenobi,项目名称:wouso,代码行数:4,代码来源:views.py


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