示例#1
0
文件: users.py 项目: JvGinkel/openode
def user_profile(request, id, tab_name=None):
    """Main user view function that works as a switchboard

    id - id of the profile owner

    todo: decide what to do with slug - it is not used
    in the code in any way
    """
    profile_owner = get_object_or_404(models.User, id=id)
    user_view_func = USER_VIEW_CALL_TABLE.get(tab_name, user_overview)

    search_state = SearchState(  # Non-default SearchState with user data set
        scope=None,
        sort=None,
        # query=None,
        tags=None,
        author=profile_owner.id,
        page=None,
        user_logged_in=profile_owner.is_authenticated(),
        node=None,
        module='qa'
    )

    context = {
        'view_user': profile_owner,
        'search_state': search_state,
        'user_follow_feature_on': ('followit' in django_settings.INSTALLED_APPS),
    }

    context['tab_name'] = tab_name
    context.update(view_context.get_for_user_profile(request.user))
    return user_view_func(request, profile_owner, context)
示例#2
0
def user_profile(request):
    if 'flags_count' not in request:
        return get_for_user_profile(request.user)
    else:
        return {}